Methods and apparatus for improving the typical running time of the bellman-ford algorithm

ABSTRACT

Disclosed are apparatus and methods for generating displays based on a layout. A layout is received that specifies a set of rectangular components, where each rectangular component has at least one size. A plurality of grid lines is determined from the layout. A system of constraints related to the plurality of grid lines is generated. A graph is generated with a plurality of nodes corresponding to the plurality of grid lines and a plurality of edges corresponding to the system of constraints. The plurality of edges is topologically sorted. Locations for the grid lines are determined by solving a single-source path-length problem for the graph to using a variant of the Bellman-Ford algorithm configured to operate with the topologically-sorted plurality of edges. A display of the rectangular components based on the locations of the grid lines.

CROSS REFERENCE TO RELATED APPLICATIONS

This application claims priority to U.S. patent application No.61/541,853, entitled “Apparatus and Methods for Efficient Layout ofComponents on a User-Interface”, filed Sep. 30, 2011, the content ofwhich is fully incorporated by reference herein for all purposes.

BACKGROUND

Many modern computer applications operating on computing devices providea graphical user-interface for user interaction. Operating systems,which control computing devices, frequently provide some type of supportto the applications to aid in designing user-interfaces to permit acommon look and feel for applications utilizing the operating system.

An example tool provided by operating systems to applications to helpdesign user-interfaces is a “layout manager” configured to receive a“layout”, or series of instructions for dividing one or morerelatively-large rectangles available for the user-interface into a setof smaller rectangles that can be separated by space. Therelatively-large rectangle(s) are typically referred to as “containers”and the smaller rectangles are typically referred to as “components.”Typically, the layout manager implements a layout strategy associatedwith the containers.

SUMMARY

In a first aspect, a computing device receives a layout configured tospecify at least a set of rectangular components within a containerrectangle. Each rectangular component has at least one size in at leastone dimension. The computing device determines a plurality of grid linesfrom the layout. Each rectangular component of the set of rectangularcomponents is associated with at least two grid lines of the pluralityof grid lines. The at least two grid lines are based on the at least onesize of the rectangular component. The computing device generates asystem of constraints, with each constraint of the system of constraintsis related to at least two grid lines of the plurality of grid lines.The computing device solves the system of constraints to determine, foreach grid line in the plurality of grid lines, a location for the gridline. The computing device generates a display of at least some of theset of rectangular components based on the locations of the grid lines.

In a second aspect, a computing device receives a user-interface layoutconfigured to specify at least a first rectangular component and asecond rectangular component, both within a container rectangle. Thefirst rectangular component has a first size in a horizontal or verticaldimension. The second rectangular component has a second size in thehorizontal or vertical dimension. The computing device determines aplurality of grid lines based on the user-interface layout. The firstrectangular component is associated with a first set of at least twogrid lines of the plurality of grid lines and the second rectangularcomponent is associated with a second set of at least two grid lines ofthe plurality of grid lines. The computing device can generate a systemof constraints, where a first constraint in the system of constraints isrelated to the first set of at least two grid lines, and where a secondconstraint in the system of constraints is related to the second set ofat least two grid lines. The computing device solves the system ofconstraints to determine, for each respective grid line in the first andsecond sets of grid lines, a respective location for the respective gridline. The computing device can generate a user-interface displayincluding the first and second rectangular components based on therespective locations of the respective grid lines. The computing devicecan display the user interface display.

In a third aspect, a computing device receives a layout configured tospecify at least a set of rectangular components within a containerrectangle. Each rectangular component has at least one size in at leastone dimension. The computing device determines a plurality of grid linesfrom the layout. Each rectangular component of the set of rectangularcomponents is associated with at least two grid lines of the pluralityof grid lines. The at least two grid lines are based on the at least onesize of the rectangular component. The computing device generates asystem of constraints, with each constraint of the system of constraintsis related to at least two grid lines of the plurality of grid lines.The computing device generates a graph including a plurality of nodesand a plurality of edges. Each node is associated with a node value. Theplurality of nodes corresponds to the plurality of grid lines and theplurality of edges corresponds to the system of constraints. Thecomputing device topologically sorts the plurality of edges. Thecomputing device determines locations for the grid lines by solving asingle-source path-length problem for the graph using a variant of theBellman-Ford algorithm configured to operate with thetopologically-sorted plurality of edges. The computing device generatesa display of at least some of the set of rectangular components based onthe locations of the grid lines.

In a fourth aspect, a computing device receives a layout configured tospecify at least a set of rectangular components within a containerrectangle with each rectangular component of the set of rectangularcomponents having at least one size in at least one dimension. The setof rectangular components includes a space component configured to benon-visible and configured not to react to user-interface events. Thecomputing device determines a plurality of grid lines from the layout.Each rectangular component of the set of rectangular components isassociated with at least two grid lines of the plurality of grid lines.The at least two grid lines are based on the at least one size of therectangular component. The computing device generates a system ofconstraints, with each constraint of the system of constraints relatesto at least two grid lines of the plurality of grid lines, The computingdevice solves the system of constraints to determine, for each grid linein the plurality of grid lines, a location for the grid line. Thecomputing device generates a display of at least some of the set ofrectangular components based on the locations of the grid lines.

In a fifth aspect, a computing device receives a layout configured tospecify at least a set of rectangular components within a containerrectangle. Each rectangular component of the set of rectangularcomponents has at least one size in at least one dimension. Thecomputing device determines a plurality of grid lines from the layout.Each rectangular component of the set of rectangular components isassociated with at least two grid lines of the plurality of grid lines.The at least two grid lines are based on the at least one size of therectangular component. The computing device generates a system ofconstraints including one or more normal-order constraints. Eachconstraint of the system of constraints is related to at least two gridlines of the plurality of grid lines. The one or more normal-orderconstraints specify a normal order for the plurality of grid lines. Thecomputing device solves the system of constraints to determine, for eachgrid line of the plurality of grid lines, a first location of the gridline. The computing device identifies at least one relaxablenormal-order constraint of the one or more normal-order constraints. Thecomputing device solves the system of constraints based on relaxing theat least one relaxable normal-order constraint to determine, for eachgrid line in the plurality of grid lines, a second location for the gridline. The second location differs from the first location for at leastone relaxed grid line in the plurality of grid lines. The computingdevice generates a display of at least some of the set of rectangularcomponents based on the second locations of the grid lines. Thecomputing device displays the display.

In a sixth aspect, a layout is received at a computing device. Thelayout is configured to specify a set of rectangular components within acontainer rectangle. Each rectangular component has at least one size inat least one dimension and is configured with a gravity parameter. Eachrectangular component is classified as flexible or non-flexible based onthe gravity parameter for the rectangular component. The computingdevice can determine a plurality of grid lines from the layout. Eachrectangular component of the set of rectangular components is associatedwith at least two grid lines of the plurality of grid lines. The atleast two grid lines are based on the at least one size of therectangular component. The computing device can generate a system ofconstraints, where each constraint of the system of constraints isrelated to at least two grid lines of the plurality of grid lines. Thecomputing device can solve the system of constraints to determine, foreach grid line in the plurality of grid lines, a location for the gridline. The computing device can generate a display of at least some ofthe set of rectangular components based on the locations of the gridlines.

In a seventh aspect, a computing device receives a layout configured tospecify at least a set of rectangular components within a containerrectangle. Each rectangular component of the set of rectangularcomponents has at least one size in at least one dimension. Thecomputing device determines a plurality of grid lines from the layout.Each rectangular component of the set of rectangular components isassociated with at least two grid lines of the plurality of grid lines.The at least two grid lines are based on the at least one size of therectangular component. The computing device generates a system ofconstraints including a minimum constraint and a maximum constraint.Each constraint of the system of constraints is related to at least twogrid lines of the plurality of grid lines. The minimum constraintspecifies a minimum value between at least two grid lines. The maximumconstraint specifies a maximum value between at least two grid lines.The computing device solves the system of constraints to determine, foreach grid line of the plurality of grid lines, a location of the gridline. The computing device generates a display of at least some of theset of rectangular components based on the locations of the grid lines.

In an eighth aspect, a computing device receives a layout configured tospecify at least a set of rectangular components within a containerrectangle. Each rectangular component of the set of rectangularcomponents has at least one size in at least one dimension. Thecomputing device determines a plurality of grid lines from the layout.Each rectangular component of the set of rectangular components isassociated with at least two grid lines of the plurality of grid lines.The at least two grid lines are based on the at least one size of therectangular component. The computing device generates a system ofconstraints. Each constraint of the system of constraints is related toat least two grid lines of the plurality of grid lines. The system ofconstraints includes inconsistent constraints. A graph with a pluralityof nodes and a plurality of edges is generated. Each node is associatedwith a node value. The plurality of nodes corresponds to the pluralityof grid lines. The plurality of edges corresponds to the system ofconstraints. The computing device solves the system of constraints todetermine locations for the grid lines using a variant of theBellman-Ford algorithm configured to operate with the inconsistentconstraints. The computing device generates a display of at least someof the set of rectangular components based on the locations of the gridlines.

These as well as other aspects, advantages, and alternatives will becomeapparent to those of ordinary skill in the art by reading the followingdetailed description with reference where appropriate to theaccompanying drawings. Further, it should be understood that thedescription provided in this summary section and elsewhere in thisdocument is intended to illustrate the claimed subject matter by way ofexample and not by way of limitation.

BRIEF DESCRIPTION OF THE FIGURES

FIG. 1 depicts a distributed computing architecture in accordance withan example embodiment.

FIG. 2A is a block diagram of a computing device in accordance with anexample embodiment.

FIG. 2B depicts a cloud-based server system in accordance with anexample embodiment.

FIG. 3 shows a scenario with an example user-interface without and withgrid lines, in accordance with an example embodiment.

FIG. 4 shows an example grid, constraints, and graph corresponding tothe example user-interface of FIG. 3, in accordance with an exampleembodiment.

FIG. 5 shows initial and final graphs for the example graph shown inFIG. 4, in accordance with an example embodiment.

FIGS. 6A and 6B show example user-interfaces based on the values in thefinal graph of FIG. 5, in accordance with an example embodiment.

FIGS. 6C, 6D, and 6E show example user-interfaces based on heightconstraints on the example user-interface of FIG. 3, in accordance withan example embodiment.

FIGS. 7A and 7B show another scenario including specification of rangesof values in an example grid, and corresponding constraints, finalgraph, and user-interface, in accordance with an example embodiment.

FIG. 8 is a flow chart of a method, in accordance with an exampleembodiment.

FIG. 9 is a flow chart of a method, in accordance with an exampleembodiment.

FIG. 10 is a flow chart of a method, in accordance with an exampleembodiment.

FIG. 11 is a flow chart of a method, in accordance with an exampleembodiment.

FIG. 12 is a flow chart of a method, in accordance with an exampleembodiment.

FIG. 13 is a flow chart of a method, in accordance with an exampleembodiment.

FIG. 14 is a flow chart of a method, in accordance with an exampleembodiment.

FIG. 15 is a flow chart of a method, in accordance with an exampleembodiment.

DETAILED DESCRIPTION

Overview

As the types of devices that support computing applications increase invariety, the challenges of designing a flexible layout manager that cansupport these devices increases accordingly. For example, it may bedesirable for a software application to be able to operate properly ondiverse types of mobile phones, tablet computers, and/or digitaltelevisions.

However, the display sizes and display resolutions (e.g., pixeldensities) supported by these devices can vary dramatically. A mobilephone might have a display resolution from as little as 208×208 or lessto as much as 960×640 or more (here, a display resolution of m×ngenerally refers to a display screen on the device supporting m pixelsin the horizontal direction and n pixels in the vertical direction). Atablet computer might support a display resolution from as little as768×480 or less to 1280×1024 or more. Modern high-definition digitaltelevisions support many display resolutions, some exceeding 1920×1080.

As a result of this great diversity in display resolution, it can bechallenging to facilitate application user-interface layouts that have aconsistent format across even a subset of all possible devices.Particularly challenging is designing a layout manager that can supportproperly displaying user-interface layouts on devices with smallerscreen resolutions.

In some layout managers, designing a layout strategy involvesspecification and subsequent determination of (i) horizontal and/orvertical alignments within a component, and (ii) fixed or changeable“flexibility” of the components within the container. The flexibility ofa component may be used to indicate the degree to which the size of thecomponent, in at least one dimension, can be adjusted in order to fitthe component within a display of components. The layout manager maythen gather the sizing, alignment, and flexibility requirements of eachcomponent within a container rectangle to produce a user-interface basedon the locations and sizes for those components. Then, the applicationcan utilize the laid-out user-interface to permit a user to interactwith the rest of the application.

This disclosure relates to generating user-interface displays based onsolving a series of constraints specified by a layout for one or morerectangular components within a container rectangle. The layout maylogically divide the container rectangle into rows and columns alongwhich the contained rectangular components are arranged. Generallyspeaking, the components can be defined to occupy more than one rowand/or more than one column of a container rectangle, as long as therows and columns are contiguous. The specification of such components isnormally indicated in terms of a starting row or column index and aspan—the vertical axis being specified with a row index and a row spanand the horizontal axis specified with a column index and a column span.

A “cell group” is defined as a set of cells that are delimited by startand end indices along both X and Y axes: four numbers in all. Forexample, if a component is desired that occupies an entire top row of auser-interface split into 5 columns and 5 rows, the cell group for thetop row can be specified within a layout using the following fournumbers:

rowStart=0

rowEnd=1

columnStart=0

columnEnd=5

In the disclosed layout system, these numbers can identify “grid lines”that separate the container rectangle into rows and columns. The rowsand columns can be specified in terms of a start index and a span or apair of start and end indices. For example, when defining four columnswithin the container, the grid lines defining the four columns can becalled X0, X1, X2, X3 and X4. Similarly, grid lines defining four rowscan be labeled Y0, Y1, Y2, Y3, and Y4. Both components and the containerrectangle can also be defined using these labels; e.g., the containerrectangle has columns spanning from X0 to X4 and rows spanning from Y0to Y4.

The indices that label the grid lines for the columns may appear in theviewing area in the “normal order”; i.e.: X0→X1→X2→X3→X4. Thecorresponding normal order condition for the rows is thatY0→Y1→Y2→Y3→Y4. However, dropping the normal order condition for somecomponents can allow grid lines to move freely over part or all of thespace governed by the container rectangle and create a significantlymore powerful system. It creates the possibility of having negative rowheights and/or column widths. For example, specifying negative rowheights and/or column widths for non-visible components can enable thelayout system to find a layout solution that better fits its contents.

The specification of components and the container rectangle using gridlines permits conversion to a series of constraints for specifying pixelpositions for the grid lines. For example, if a component is specifiedin the x-dimension by grid lines X1 to X3 and has to be exactly 200pixels wide, a corresponding constraint is specified in the x-dimensionfor this component is X3−X1=200. If the component is specified in they-dimension by grid lines Y2 and Y3 and has to be between 150 and 200pixels high, two corresponding constraints can be used to specify therow condition: Y2−Y3≧−200 and Y3−Y2≧150.

In some embodiments, components and containers having one dimension ormore than two dimensions can be specified. In each dimension, though,one pair of numbers can be used define a starting position and an endingposition within the dimension; thus, to specify a component of Ndimensions, 2N numbers can be used.

The set of constraints can then be solved using linear programming orother algorithms. In one embodiment, the set of constraints can beconverted into a corresponding graph. A “single-source path-lengthproblem” can be solved for the graph to determine locations for each ofthe grid lines relative to a source grid line. Examples of thesingle-source path-length problem include a “single-source shortest-pathproblem” to find shortest paths between a single source node and theother nodes in the graph and a “single-source longest-path problem” tofind longest paths between the single source node and the other nodes inthe graph. The layout system can use these locations to specifylocations of the grid lines within the container rectangle, and generatea display of at least some of the components within the containerrectangle using the located grid lines.

One algorithm for solving the single-source path-length problem is theBellman-Ford algorithm. In one aspect of the disclosure, animplementation of a Bellman-Ford algorithm variant disclosed herein cansolve a single-source path-length problem with an average run time onO(|E|), where |E|=the number of arcs (edges) in the graph correspondingto the set of constraints. In some particular aspects, the graph can bea directed graph. In other particular aspects, arcs in the graphrepresenting invalid constraints can be identified and removed by theimplementation of the Bellman-Ford algorithm variant disclosed herein.

The layout system accepts simplified specifications of layouts that donot require explicit specification of flexibility constants. (As notedabove, the flexibility of a component indicates how much the size of thecomponent, in at least one dimension, can be adjusted in order to fitthe component in a display of components.) In declarative systems andconventional objected oriented systems the user typically has the optionnot to declare the gravity at all. The disclosed system can utilize theundefined state to infer the flexibility of the component within a rowor column. If a horizontal or vertical alignment was defined for acomponent, then the flexibility for the component can be considered tobe flexible as it is already defined what should happen to the extraspace. In the case where “gravity,” or horizontal/vertical alignment, isnot explicitly defined, the system can infer the opposite: that thecell's size is fixed by the size of the component, such a text, abutton, a display, etc. that it contains and thus is non-flexible. Inanother case, where no sizes are specified for a given component such asa herein-described Space component, the given component can beconsidered to be flexible.

To further infer the flexibility of the rows and columns even when theycontain multiple components the following two reduction rules may bedeployed:

Rule 1: Elements in parallel (e.g., aligned in a column) are flexible ifall of the parallel elements are flexible.

Rule 2: Elements in series (e.g., in a row) are flexible if one of theseries elements is flexible. By removing explicit specification offlexibility, the layout manager simplifies the specification of layoutsby user-interface designers and tools.

The layout manager permits relaxation of the normal order condition ofrows and columns for grid lines associated with non-visible components.Relaxation of the normal order condition can enable, in some instances,complete display of a user-interface even when the container rectangleis smaller than required under the normal order condition. Further, inembodiments disclosed herein, the layout manager utilizes efficientalgorithms to operate quickly, enabling rapid resizing and redrawingoperations of user-interfaces.

Example Data Network

Turning to the Figures, FIG. 1 shows server devices 108, 110 configuredto communicate, via network 106, with programmable devices 104 a, 104 b,and 104 c. Network 106 may correspond to a LAN, a wide area network(WAN), a corporate intranet, the public Internet, or any other type ofnetwork configured to provide a communications path between networkedcomputing devices. The network 106 may also correspond to a combinationof one or more LANs, WANs, corporate intranets, and/or the publicInternet.

Although FIG. 1 only shows three programmable devices, distributedapplication architectures may serve tens, hundreds, or thousands ofprogrammable devices. Moreover, programmable devices 104 a, 104 b, and104 c (or any additional programmable devices) may be any sort ofcomputing device, such as an ordinary laptop computer, desktop computer,network terminal, wireless communication device (e.g., a cell phone orsmart phone), and so on. In some embodiments, programmable devices 104a, 104 b, and 104 c may be dedicated to the design and use of softwareapplications. In other embodiments, programmable devices 104 a, 104 b,and 104 c may be general purpose computers that are configured toperform a number of tasks and need not be dedicated to softwaredevelopment tools.

Server devices 108, 110 can be configured to perform one or moreservices, as requested by programmable devices 104 a, 104 b, and/or 104c. For example, server device 108 and/or 110 can provide content toprogrammable devices 104 a-104 c. The content can include, but is notlimited to, web pages, hypertext, scripts, binary data such as compiledsoftware, images, audio, and/or video. The content can includecompressed and/or uncompressed content. The content can be encryptedand/or unencrypted. Other types of content are possible as well.

As another example, server device 108 and/or 110 can provideprogrammable devices 104 a-104 c with access to software for database,search, computation, graphical, audio, video, World Wide Web/Internetutilization, and/or other functions. Many other examples of serverdevices are possible as well.

Computing Device Architecture

FIG. 2A is a block diagram of a computing device (e.g., system) inaccordance with an example embodiment. In particular, computing device200 shown in FIG. 2A can be configured to perform one or more functionsof server devices 108, 110, network 106, and/or one or more ofprogrammable devices 104 a, 104 b, and 104 c. Computing device 200 mayinclude a user-interface module 201, a network-communication interfacemodule 202, one or more processors 203, and data storage 204, all ofwhich may be linked together via a system bus, network, or otherconnection mechanism 205.

User-interface module 201 can be operable to send data to and/or receivedata from external user input/output devices. For example,user-interface module 201 can be configured to send and/or receive datato and/or from user input devices such as a keyboard, a keypad, a touchscreen, a computer mouse, a track ball, a joystick, a camera, a voicerecognition module, and/or other similar devices. User-interface module201 can also be configured to provide output to user display devices,such as one or more cathode ray tubes (CRT), liquid crystal displays(LCD), light emitting diodes (LEDs), displays using digital lightprocessing (DLP) technology, printers, light bulbs, and/or other similardevices, either now known or later developed. User-interface module 201can also be configured to generate audible output(s), such as a speaker,speaker jack, audio output port, audio output device, earphones, and/orother similar devices. In particular, computing device 200 withuser-interface module 201 can be used to display a user-interface thatincludes one or more components within a container rectangle.

Network-communications interface module 202 can include one or morewireless interfaces 207 and/or one or more wireline interfaces 208 thatare configurable to communicate via a network, such as network 106 shownin FIG. 1. Wireless interfaces 207 can include one or more wirelesstransmitters, receivers, and/or transceivers, such as a Bluetoothtransceiver, a Zigbee transceiver, a Wi-Fi transceiver, a WiMAXtransceiver, and/or other similar type of wireless transceiverconfigurable to communicate via a wireless network. Wireline interfaces208 can include one or more wireline transmitters, receivers, and/ortransceivers, such as an Ethernet transceiver, a Universal Serial Bus(USB) transceiver, or similar transceiver configurable to communicatevia a twisted pair wire, a coaxial cable, a fiber-optic link, or asimilar physical connection to a wireline network.

In some embodiments, network communications interface module 202 can beconfigured to provide reliable, secured, and/or authenticatedcommunications. For each communication described herein, information forensuring reliable communications (i.e., guaranteed message delivery) canbe provided, perhaps as part of a message header and/or footer (e.g.,packet/message sequencing information, encapsulation header(s) and/orfooter(s), size/time information, and transmission verificationinformation such as CRC and/or parity check values). Communications canbe made secure (e.g., be encoded or encrypted) and/or decrypted/decodedusing one or more cryptographic protocols and/or algorithms, such as,but not limited to, DES, AES, RSA, Diffie-Hellman, and/or DSA. Othercryptographic protocols and/or algorithms can be used as well or inaddition to those listed herein to secure (and then decrypt/decode)communications.

Processors 203 can include one or more general purpose processors and/orone or more special purpose processors (e.g., digital signal processors,application specific integrated circuits, etc.). Processors 203 can beconfigured to execute computer-readable program instructions 206 a thatare contained in the data storage 204 and/or other instructions asdescribed herein.

Data storage 204 can include one or more computer-readable storage mediathat can be read and/or accessed by at least one of processors 203. Theone or more computer-readable storage media can include volatile and/ornon-volatile storage components, such as optical, magnetic, organic orother memory or disc storage, which can be integrated in whole or inpart with at least one of processors 203. In some embodiments, datastorage 204 can be implemented using a single physical device (e.g., oneoptical, magnetic, organic or other memory or disc storage unit), whilein other embodiments, data storage 204 can be implemented using two ormore physical devices.

Data storage 204 can include computer-readable program instructions 206a, actual environment 206 b, and perhaps additional data. Actualenvironment 206 b can store at least some of the data used by one ormore processes and/or threads of a software application. In someembodiments, data storage 204 can additionally include storage requiredto perform at least part of the herein-described methods and techniquesand/or at least part of the functionality of the herein-describeddevices and networks.

Cloud-Based Servers

FIG. 2B depicts a network 106 of computing clusters 209 a, 209 b, 209 carranged as a cloud-based server system in accordance with an exampleembodiment. Server devices 108 and/or 110 can be cloud-based devicesthat store program logic and/or data of cloud-based applications and/orservices. In some embodiments, server devices 108 and/or 110 can be asingle computing device residing in a single computing center. In otherembodiments, server device 108 and/or 110 can include multiple computingdevices in a single computing center, or even multiple computing deviceslocated in multiple computing centers located in diverse geographiclocations. For example, FIG. 1 depicts each of server devices 108 and110 residing in different physical locations.

In some embodiments, data and services at server devices 108 and/or 110can be encoded as computer readable information stored in tangiblecomputer readable media (or computer readable storage media) andaccessible by programmable devices 104 a, 104 b, and 104 c, and/or othercomputing devices. In some embodiments, data at server device 108 and/or110 can be stored on a single disk drive or other tangible storagemedia, or can be implemented on multiple disk drives or other tangiblestorage media located at one or more diverse geographic locations.

FIG. 2B depicts a cloud-based server system in accordance with anexample embodiment. In FIG. 2B, the functions of server device 108and/or 110 can be distributed among three computing clusters 209 a, 209b, and 209 c. Computing cluster 209 a can include one or more computingdevices 200 a, cluster storage arrays 210 a, and cluster routers 211 aconnected by a local cluster network 212 a. Similarly, computing cluster209 b can include one or more computing devices 200 b, cluster storagearrays 210 b, and cluster routers 211 b connected by a local clusternetwork 212 b. Likewise, computing cluster 209 c can include one or morecomputing devices 200 c, cluster storage arrays 210 c, and clusterrouters 211 c connected by a local cluster network 212 c.

In some embodiments, each of the computing clusters 209 a, 209 b, and209 c can have an equal number of computing devices, an equal number ofcluster storage arrays, and an equal number of cluster routers. In otherembodiments, however, each computing cluster can have different numbersof computing devices, different numbers of cluster storage arrays, anddifferent numbers of cluster routers. The number of computing devices,cluster storage arrays, and cluster routers in each computing clustercan depend on the computing task or tasks assigned to each computingcluster.

In computing cluster 209 a, for example, computing devices 200 a can beconfigured to perform various computing tasks of electroniccommunications server 112. In one embodiment, the variousfunctionalities of electronic communications server 112 can bedistributed among one or more of computing devices 200 a, 200 b, and 200c. Computing devices 200 b and 200 c in computing clusters 209 b and 209c can be configured similarly to computing devices 200 a in computingcluster 209 a. On the other hand, in some embodiments, computing devices200 a, 200 b, and 200 c can be configured to perform differentfunctions.

In some embodiments, computing tasks and stored data associated withserver devices 108 and/or 110 can be distributed across computingdevices 200 a, 200 b, and 200 c based at least in part on the processingrequirements of server devices 108 and/or 110, the processingcapabilities of computing devices 200 a, 200 b, and 200 c, the latencyof the network links between the computing devices in each computingcluster and between the computing clusters themselves, and/or otherfactors that can contribute to the cost, speed, fault-tolerance,resiliency, efficiency, and/or other design goals of the overall systemarchitecture.

The cluster storage arrays 210 a, 210 b, and 210 c of the computingclusters 209 a, 209 b, and 209 c can be data storage arrays that includedisk array controllers configured to manage read and write access togroups of hard disk drives. The disk array controllers, alone or inconjunction with their respective computing devices, can also beconfigured to manage backup or redundant copies of the data stored inthe cluster storage arrays to protect against disk drive or othercluster storage array failures and/or network failures that prevent oneor more computing devices from accessing one or more cluster storagearrays.

Similar to the manner in which the functions of server devices 108and/or 110 can be distributed across computing devices 200 a, 200 b, and200 c of computing clusters 209 a, 209 b, and 209 c, various activeportions and/or backup portions of these components can be distributedacross cluster storage arrays 210 a, 210 b, and 210 c. For example, somecluster storage arrays can be configured to store the data of serverdevice 108, while other cluster storage arrays can store data of serverdevice 110. Additionally, some cluster storage arrays can be configuredto store backup versions of data stored in other cluster storage arrays.

The cluster routers 211 a, 211 b, and 211 c in computing clusters 209 a,209 b, and 209 c can include networking equipment configured to provideinternal and external communications for the computing clusters. Forexample, the cluster routers 211 a in computing cluster 209 a caninclude one or more internet switching and routing devices configured toprovide (i) local area network communications between the computingdevices 200 a and the cluster storage arrays 210 a via the local clusternetwork 212 a, and (ii) wide area network communications between thecomputing cluster 209 a and the computing clusters 209 b and 209 c viathe wide area network connection 213 a to network 106. Cluster routers211 b and 211 c can include network equipment similar to the clusterrouters 211 a, and cluster routers 211 b and 211 c can perform similarnetworking functions for computing clusters 209 b and 209 b that clusterrouters 211 a perform for computing cluster 209 a.

In some embodiments, the configuration of the cluster routers 211 a, 211b, and 211 c can be based at least in part on the data communicationrequirements of the computing devices and cluster storage arrays, thedata communications capabilities of the network equipment in the clusterrouters 211 a, 211 b, and 211 c, the latency and throughput of localnetworks 212 a, 212 b, 212 c, the latency, throughput, and cost of widearea network links 213 a, 213 b, and 213 c, and/or other factors thatcan contribute to the cost, speed, fault-tolerance, resiliency,efficiency and/or other design goals of the moderation systemarchitecture.

Example Layout

FIG. 3 depicts a scenario 300 regarding an example user-interface 310,in accordance with an embodiment. An example layout that definesuser-interface 310 that can be displayed using a computing device, suchas computing device 200, is shown in Table 1 below.

TABLE 1 <GridLayout  xmlns:abc=“http:// ... /apk/res/abc” layout_width=“match_parent”  layout_height=“match_parent” useDefaultMargins=“true”  alignmentMode=“alignBounds” rowOrderPreserved=“false”  columnCount=“4”  >  <TextView   text=“Emailsetup”   textSize=“32dip”   layout_columnSpan=“4”  layout_gravity=“center_horizontal”  />  <TextView   text=“You canconfigure email in just a few steps:”   textSize=“16dip”  layout_columnSpan=“4”   layout_gravity=“left”  />  <TextView  text=“Email address:”   layout_gravity=“right”  />  <EditText  ems=“10”  />  <TextView   text=“Password:”   layout_column=“0”  layout_gravity=“right”  />  <EditText   ems=“8”  />  <Space  layout_row=“2”   layout_rowSpan=“3”   layout_column=“2”  layout_gravity=“fill”  />  <Button   text=“Manual setup”  layout_row=“5”   layout_column=“3”  />  <Button   text=“Next”  layout_column=“3”   layout_gravity=“fill horizontal”  /> </GridLayout>

Table 1 is an eXtended Markup Language (XML) document that defines alayout called a “GridLayout”. Generally, an XML document includes a rootelement and zero or more sub-elements of the root element. An XML rootelement or sub-element includes at least one tag, and may have a starttag, content, and an end tag. A start tag is of the form <tag[attrib1=“value”, [attrib2=“value2” . . . ]>, where tag is the name ofthe XML (sub-) element, and attrib1 and attrib2 are optional attributesthat modify and/or provide information about the XML (sub-) element. Thecontent starts after the start tag. End tags delimit the end of thecontent and are typically denoted as </tag>.

The GridLayout root element can be used to define a user-interface thatutilizes grid lines for placement of components within a grid rectangle.The GridLayout root element start and end tags of Table 1 are shownseparately in Table 1.1 below.

TABLE 1.1 <GridLayout  xmlns:abc=“http:// ... /apk/res/abc” layout_width=“match_parent”  layout_height=“match_parent” useDefaultMargins=“true”  alignmentMode=“alignBounds” rowOrderPreserved=“false”  columnCount=“4” > . . . </GridLayout>

As shown in Table 1.1, the GridLayout start tag specifies an XMLnamespace via a Uniform Resource Locator (URL), and a number ofparameters. These parameters include parameters for specifying: layoutwidth and height, default margins, an alignment mode, row orderpreservation, and a number of columns. The row order preservationparameter being set equal to “false” indicates that the layout manageris permitted, under certain conditions, to relax the normal orderconstraint for the rows of the layout. In the example of Tables 1 and1.1, the number of columns is set to 4. In other embodiments, more orfewer parameters can be specified as part of the GridLayout element. TheGridLayout end tag is shown on the last line of Table 1 and duplicatedas the last line of Table 1.1.

Between the GridLayout start tag and end tag is the content, whichdefines the sub-elements of the GridLayout element. In the example shownin Table 1, the GridLayout root element has nine sub-elements: fourTextView sub-elements, two EditText sub-elements, two Buttonsub-elements, and one Space sub-element. For simplification, Table 1.1replaces these sub-elements with an ellipsis. In some examples, such asuser-interface 310, the GridLayout element can be used to specifyattributes of the container rectangle for the user-interface, while thesub-elements of the GridLayout element can be used to specify attributesof components of the user-interface.

A TextView sub-element can be used to specify text to be displayed in auser-interface, such as user-interface 310. The first TextViewsub-element of the GridLayout element in Table 1 is shown separately inTable 1.2 below:

TABLE 1.2 <TextView  text=“Email setup”  textSize=“32dip” layout_columnSpan=“4”  layout_gravity=“center_horizontal” />

As shown in Table 1.2, the TextView sub-element's tag can specify text,a text size, a column “span” or number of columns occupied by theTextView sub-element, and a “gravity” parameter. In this example, thetext is “Email setup”, the text size is 32 density-independent pixels(dip), and the number of columns in the column span is 4 as specified bythe columnSpan parameter for this component. In other examples, a rowand/or column number can be specified, a row span can be specified, andother units can be used for text sizes than dip-units; e.g., points of afont, pixels, ems, inches, centimeters, and/or other suitable units.

The gravity parameter governs placement of the component within a cellgroup. In the example of table 1.2, the gravity is “center_horizontal”indicating the text “Email setup” for this TextView sub-element is to becentered horizontally within the cell group. Other example horizontalgravity values include “top”, “bottom”, “fill_horizontal”, whichstretches the component to completely take up the space within the cellgroup, and “baseline,” which aligns the text of the component along the“baseline.” The baseline is the imaginary line upon which most lettersin a given font “sit” and below which is used by the descending portions(e.g., the tail of the letter “p”) of letters in a font. Using theexample word “dog”, the bottoms of the letters “d” and “o” and the topcircle of the letter “g” are on the baseline, while the tail of theletter “g” descends below the baseline.

In some examples, vertical gravity values can be used instead of or inaddition to horizontal gravity values. Example vertical gravity valuesinclude “left”, “center_vertical”, “right”, and “fill_vertical.” Also,horizontal and vertical gravity values can be specified together; e.g.,specifying both layout_gravity=“center_horizontal” for horizontalcentering within the cell group, and layout_gravity=“center_vertical”for vertical centering within the cell group, thereby centering thecomponent both horizontally and vertically within the cell group.

A GridLayout element can be associated with a grid of rows and columns.The grid can be specified, at least in part, by the GridLayout element.In the example shown in Tables 1 and 1.1, the GridLayout elementspecifies that there are four columns in the grid using the columnCountparameter. Also, the sub-elements can specify part or the entire grid;for example, by specifying starting, spanning, and/or ending columns androws.

An EditText sub-element can be used to permit text to be entered via auser-interface, such as user-interface 310. The first EditTextsub-element of the GridLayout element in Table 1 is shown separately inTable 1.3 below:

TABLE 1.3 <EditText  ems=“10” />

The EditText sub-element shown in Table 1.3 has one parameter “ems”which specifies the size of a text-entry region for entering text. Inthis example, the text-entry region is 10 “ems” in size. Ems are unitsthat define letters with respect to a point size of a particular font;e.g., the point size and font used for entering text into the text-entryregion. In other examples, the size of the text-entry region can beprovided in units other than “ems”; e.g., dip-units, pixels, points of afont, ems, inches, centimeters, and/or other suitable units.

A Space sub-element can be used to permit specification of a non-visiblecomponent of a user-interface, such as user-interface 310. In someembodiments, when rendered as part of the user-interface, the Spacesub-element is transparent, does not react to user-interface events(e.g., clicks, taps, mouse-overs, pinch-gestures, etc.), and cannot havechildren. On the other hand, a non-Space component may react to someuser-interface events. As such, an implementation of a componentcorresponding to the Space sub-element can consume fewer systemresources than a non-Space component.

The Space sub-element of the GridLayout element in Table 1 is shownseparately in Table 1.4 below:

TABLE 1.4 <Space  layout_row=“2”  layout_rowSpan=“3”  layout_column=“2” layout_gravity=“fill” />

Because the Space component is a regular component, it may haveproperties specified as parameters, just as with non-Space components.The Space sub-element shown in Table 1.4 has four parameters:“layout_row” which specifies a starting row of the GridLayout grid forthe Space component, “rowSpan” which specifies a number of rows of theGridLayout grid occupied by the Space component, “layout_column” whichspecifies a starting column of the GridLayout grid for the Spacecomponent, and a “layout_gravity” parameter whose value is “fill” tospecify a vertical fill. Based on the specified starting row of 2 andthe row span of 3, the Space component will occupy rows 2, 3, and 4, incolumn 2 of the user-interface.

By making widgets for Space components inherit from a common super-classas widgets for non-Space components, the Space component can acquireautomatic support in existing layout strategies. For example, the Spacecomponent can be implemented as a subclass of the base class/commonsuper-class for widgets used within the user-interface. Continuing thisexample, all components utilized by the layout manager could have a baseclass or common super-class of Component. The Component class can havemethods and/or data related to all component widgets, such as dataand/or methods for rows, row spans, columns, column spans, flexibility,gravity, and grid lines, with many other examples being possible aswell.

The Component class can have sub-classes such as SpaceComponent forSpace-component related widgets and VisibleComponent fornon-Space-component related widgets with visible component methods anddata. Example Space-component methods and data include text-relateddata/methods, graphical-object-related data/methods, button-relateddata/methods, Example visible component methods and data includetext-related data/methods, graphical-object-related data/methods,button-related data/methods, with many other examples of sub-classes,methods, and data being possible as well.

Space components can unify the principle of space across multiple layoutstrategies. In particular, in a GridLayout, a Space component can beused to specify where space is inserted within a user-interface and howthe space should behave when the container rectangle is resized.

Also, a Space component with a specified gravity, such as the Spacecomponent defined in Table 1.4, is a flexible component. As such, thesize of the Space component can be altered as required by the layoutmanager. For example, suppose the Space component (or other flexiblecomponent) is within a container rectangle whose size exactly matches adisplay window used to display user-interface 310. Then, suppose thedisplay window is resized by the user to either grow or shrink. Inresponse to the display window being resized, the layout manager canadjust the size of flexible components, such as the Space component, sothat user-interface 310 fits as best feasible within the resized displaywindow. For example, one or more sizes of the Space component can beincreased as the display window grows, or decreased as the displaywindow shrinks.

In some embodiments, a Space component can be used to specify additionalgrid lines within the GridLayout. In some scenarios, the additional gridlines can violate the normal order condition, because they relate to anon-visible component. As such, the grid lines can permit overlappingrows and/or columns when a container rectangle is smaller than apre-determined size. See user-interface 610 a of FIG. 6B and thediscussion below for an example of overlapping rows.

A Button sub-element can be used to specify a button for auser-interface, such as user-interface 310. The first Button sub-elementof the GridLayout element in Table 1 is shown separately in Table 1.5below:

TABLE 1.5 <Button  text=“Manual setup”  layout_row=“5” layout_column=“3” />

The Button sub-element shown in Table 1.3 has three parameters: “text”of “Manual setup” which is text to be displayed on the button inuser-interface 310, “layout_row” which specifies a starting row of theGridLayout grid for the Button sub-element, and “layout_column” whichspecifies a starting column of the GridLayout grid for the Buttonsub-element. Based on the specified “layout_row” and “layout_column”,the Button component specified as specified in Table 1.5 will start atrow 5, column 3 of user-interface 310.

In other examples, a GridLayout element can have more, fewer, and/ordifferent sub-elements than shown in Tables 1 through 1.5.Correspondingly, in these other examples, user-interface 310 can havemore, fewer, and/or different components than shown in FIG. 3. In otherembodiments, GridLayouts can be specified using techniques other thanXML.

FIG. 3 shows user-interface 310 with text 320 and 322, which correspondsrespectively to the first and second TextView sub-elements of Table 1.As each TextView sub-element spans all four columns of user-interface310, each sub-element is shown on a separate TOW.

Text 324 corresponds to the third TextView sub-element of Table 1—asthis TextView sub-element does not include specification of a“columnSpan” parameter, the default column span of 1 column is used.Then, the next sub-element specified in Table 1—the first EditTextsub-element of Table 1—is shown in FIG. 3 as text entry (TE) region 326to the right of text 324.

Table 1 then specifies a fourth TextView sub-element, corresponding totext 328, which has a starting column of “0” as specified using thelayout_column parameter and uses the default column span of 1 column.Thus, as text 328 begins in column 0, text 328 begins on a row belowtext 324. Then, the next sub-element specified in Table 1—the secondEditText sub-element of Table 1—is shown in FIG. 3 as text entry (TE)region 330 to the right of text 328.

Table 1 continues with the Space sub-element which, as mentioned abovewill occupy rows 2, 3, and 4 of column 2 of the user-interface. As Table1 numbers rows and columns starting with 0, the Space sub-element willoccupy the third, fourth, and fifth rows of the third column in thecorresponding user-interface. As shown in FIG. 3, space 332 (indicatedusing cross-hatching for clarity's sake) occupies the third, fourth, andfifth rows of the third column of user-interface 310. The fifth row ofuser-interface 310 is shown in the top portion of FIG. 3 as theextension of space 332 below text 328 and text entry region 330. In someembodiments, space components are not visible and thus do not havecross-hatching or any other visible indication of being part of auser-interface, such as user-interface 310.

Table 1 concludes with two Button sub-elements respectivelycorresponding to buttons 334 and 336. The Button sub-elementcorresponding to button 334 indicates that the button has text of“Manual setup” and is positioned to be in row 5, column 3 of theGridLayout; that is in the sixth row and fourth column of user-interface310; just below and to the right of space 332. Finally, the Buttonsub-element corresponding to button 336 indicates that the button hastext of “Next” and is positioned to be in GridLayout column 3 which isuser-interface 310's fourth column. As button 334 is already occupyingthe fourth column in the sixth row of user-interface 310, FIG. 3 showsbutton 336 occupying the fourth column in the next or seventh row ofuser-interface 310.

The bottom portion of FIG. 3 shows columns and rows of user-interface310 and corresponding grid lines (GLs). Grid lines are lines separatingthe rows and columns within a GridLayout element and in thecorresponding user-interface. FIG. 3 shows user-interface 310 with sevenrows 340-346 and four columns 350-353. Each row is defined by two gridlines: for example, FIG. 3 shows row 340 bounded above by grid line Y0and bounded below by grid line Y1. Similarly, each column is defined bytwo grid lines: for example, FIG. 3 shows column 352 bounded to the leftby grid line X2 and bounded to the right by grid line X3.

FIG. 4 shows scenario 300 continuing with determination of constraintscorresponding to the components within a layout, and determination of agraph corresponding to the constraints, in accordance with anembodiment.

The top portion of FIG. 4 depicts a grid 400 based on user-interface310.

FIG. 4 shows that grid 400 includes grid lines X0-X4 and Y0-Y7 as shownin FIG. 3 and, more particularly, based on the GridLayout element andsub-elements specified in Table 1 above. FIG. 4 also shows a set ofcomponents (C's) 402-418 depicted as grey rectangles that correspond tocomponents 320-336 of user-interface 310. For example, component 402 ofgrid 400 corresponds to text 320 of user-interface 310, as both text 320and component 402 are on the top row and both span all columns of eitheruser-interface 310 (for text 320) or grid 400 (for component 402).

Table 2 shows the correspondence between user-interface components shownin FIG. 3 and grid components, constraints, and edges in graph 440 allshown in FIG. 4:

TABLE 2 User-interface Grid Edge in Component Component Constraint Graph440 Text 320 Component 402 Constraint 422 Edge 442 Text 322 Component404 Constraint 424 Edge 444 Text 324 Component 406 Constraint 426 Edge446 Text Entry Region 326 Component 408 Constraint 428 Edge 448 Text 328Component 412 Constraint 432 Edge 452 Text Entry Region 330 Component414 Constraint 434 Edge 454 Space 332 Component 410 Constraint 430 Edge450 Button 334 Component 416 Constraint 436 Edge 456 Button 336Component 418 Constraint 438 Edge 458

Each row and column of grid 400, like rows and columns of user-interface310, are defined by two grid lines. For a row example, FIG. 4 shows thefirst row of grid 400 bounded above by grid line Y0 and bounded below bygrid line Y1. As a column example, FIG. 4 shows the rightmost column ofgrid 400 bounded to the left by grid line X3 and bounded to the right bygrid line X4.

Each component can determine numerical values for one or more sizes asit would be rendered on a display, and pass those numerical values onthe layout manager. For the example of a text sub-element, a width and aheight of the sub-element in pixels or other units can be determined. Insome embodiments, the width and height values can be based on the textto be displayed, a font and font size used to display the text of thetext sub-element, text features used (e.g. underlining, bold face, etc.)As one example, 72 points of text can be rendered within 1 inch ofhorizontal text, or on a display device displaying text at 96pixels/inch, rendered within 96 horizontal pixels. In particularembodiments, the layout manager can add margins to the text whichcorrespondingly increase the numerical height and/or width values of thetext component.

In particular, the spacing requirements between the rectangles ofuser-interface 310 can be re-expressed, as needed, so that there is noexcess space between components 402-418 of grid 400 of FIG. 4. However,as shown in FIG. 4, some or all of the components 402-418 of grid 400can overlap either partially or completely.

FIG. 4 shows each component 402-418 of grid 400 with a correspondingwidth in pixels; for example, the text of user-interface component 320,and corresponding grid component 402, has been determined by the layoutmanager to fit within a component whose width is 160 pixels. In somescenarios not shown in FIG. 4, each component 402-418 can have acorresponding height in pixels as well. In some embodiments, componentsizes, such as but not limited to, heights and/or widths, can bespecified in units other than pixels. As shown in FIG. 4, grid 400 has aset of vertical grid lines {X0, X1 . . . X4} and a set of horizontalgrid lines {Y0, Y1 . . . Y7}. In other scenarios, grid 400 can have onlyone set of grid lines (e.g., only vertical grid lines) or have more thantwo sets of grid lines (e.g., vertical, horizontal, and depth gridlines).

The horizontal and vertical aspects of the layout problem can beseparated, permitting independent computation of the locations of gridlines for the rows and the locations of grid lines for the columns. Asthe horizontal and vertical aspects of the layout problem areindependent, only computation of the locations of grid lines for thecolumns is described at this time to simplify scenario 300. See thediscussion below regarding FIGS. 6C-6E and computation of locations forgrid lines of rows.

As such, each component 402-418 of grid 400 has at least fourproperties:

1. A minimum width (may be zero).

2. A minimum height (may be zero).

3. Two grid lines from the set of grid lines {X0 . . . X4} aligned withthe component's left and right edges.

4. Two grid lines from the set of grid lines {Y0 . . . Y7} are alignedwith the component's top and bottom edges.

Once these properties have been determined for each component ofuser-interface 310 and corresponding grid 400, a set of numeric valuescorresponding to each grid line of the set of vertical grid lines {X0,X1, X2, . . . } and horizontal grid lines {Y0, Y1, Y2, . . . } aredetermined such that each child component has at least as much space asit requested.

As each component has a minimum width and is associated with two gridlines aligned with the component's left and right edges, a constraintcan be determined that corresponds to these properties. For example,grid 400 shows the left edge of component 402 aligned with grid line X0,the right edge of component 402 aligned with grid line X4, and a pixelvalue (shown in the middle of component 402) of 160 pixels, indicatingthat component 402 is at least 160 pixels wide. As component 402 spansthe width of grid 400, component 402 is aligned with grid line X0 on theleft edge and grid line X4 on the right edge. These conditionscorrespond to constraint 422 of “X4−X0≧160” pixels.

As another example, grid 400 shows that the left edge of component 414is aligned with grid line X1, the right edge of component 414 is alignedwith grid line X2, and a pixel value (shown in the middle of component414) of 130 pixels, indicating that component 414 is at least 160 pixelswide. These conditions for component 414 correspond to constraint 434 of“X2−X1≧130” pixels.

The middle portion of FIG. 4 shows a set of constraints 422-438. Eachconstraint of constraints 422-438 correspond to each component 402-418of grid 400. As another example, constraint 430, which corresponds tocomponent 410, indicates that a location of the right edge (X3) ofcomponent 410 has to be greater than or equal to a location of the leftedge (X2) of component 410. In other scenarios, such as discussed belowin the context of FIGS. 6C and 6D, similar constraints can be determinedfor the set of horizontal grid lines {Y0 . . . Y7} of grid 400.

For each set of constraints, a graph can be determined with the nodescorresponding to the grid lines and the edges corresponding to theconstraints on the grid lines. The bottom portion of FIG. 4 shows graph440 with nodes shown as grey circles. Graph 440 has one node for eachvertical grid line X0, X1, X2, X3, and X4. Graph 440 also has edges442-458 corresponding to constraints 420. Each of edges 442-458 in graph440 has a one-to-one correspondence with constraints 422-438. As statedabove, each constraint 422-438 corresponds to a component 402-418 ingrid 400. For example, as shown in Table 2 above, edge 444 correspondsto both component 404 and constraint 424.

As the location of X0 grid line can be pre-determined to be at theorigin, e.g., X0=0, node X0 of graph 440 can be designated as a “source”node. Under the normal order condition, all vertical grid lines havelocations to the right of X0, then the locations of all grid lines X0 .. . X4 can be initially assumed to be non-negative. Further, as eachlocation X0 . . . X4 has to be determined to solve the layout problem.Thus, a value can be assigned to each node X0 . . . X4 of graph 440 thatcorresponds to the maximum distance in pixels required to go from thesource node X0 to that node.

A variant of the Bellman-Ford algorithm can operate on graph 440 todetermine the maximum size in one dimension specified by each componentin grid 400 and correspondingly, user-interface 310. The Bellman-Fordalgorithm variant can be used to solve the single-source longest-pathproblem by assigning a value to each node beyond the source node, basedon values of the edges of the corresponding graph, that represent abenefit from the source to each respective node. As the Bellman-Fordalgorithm variant evaluates edges of the graph, the values of the nodescan be adjusted to either determine (a) the graph has a solution or (b)there are edges leading to a “positive cycle” on the graph. If the graphhas a solution, the value at a given node corresponds to a benefit for alongest path between the source node and the given node.

In solving the single-source longest-path problem, the Bellman-Fordalgorithm initially sets the value of the source node to 0 and sets theremaining node values to invalid values, such as +∞ or −∞. In someembodiments, the Bellman-Ford algorithm variant can initialize all ofthe node values to a common value, such as 0. In these embodiments, thisis equivalent to connecting all nodes to a synthetic source node whosevalue is set to 0 and with the edge weights for the edges from thesynthetic source node to all nodes all equal to the common value.

FIG. 5 shows initial graph 500 using a common value of 0 for all nodesX0 through X4. That is, initial graph 500 is initialized by theBellman-Ford algorithm variant that initializes all node values to acommon value of 0.

Pseudo-code of a variant of the Bellman-Ford algorithm that aborts whennode values no longer change is presented in the Table 3 below. Table 3shows a solve method that takes two parameters: a list of arcs (arcs),corresponding to the edges of the graph, and a list of locations(locations) corresponding to the nodes of the graph. The solve method inturn calls the relax function to determine if a node value should beupdated or not.

TABLE 3 private boolean relax(int[ ] locations, Arc entry) {  intervalspan = entry.span;  int u = span.min;  int v = span.max;  int value =entry.value.value;  int candidate = locations[u] + value;  /* relax( )solves single-source longest path problem   * change “>” in next line to“<” to solve single-source   * shortest-path problem   */  if(candidate > locations[v]) {   locations [v] = candidate;   return true; }  return false; } private int[ ] solve(Arc[ ] arcs, int[ ] locations){  boolean changed = false;  /* The Outer Loop */  for (int i = 0; i <locations.length + 1; i++) {   changed = false;   /* The Inner Loop */  for (int j = 0, length = arcs.length; j < length; j++) {    changed =changed | relax(locations, arcs[j]);   }   /* End of the Inner Loop */  if (!changed) {    break;   }  }  /* End of the Outer Loop */  if(changed) {   exit_with_error(“Algorithm failed to terminate”);  } return locations; }

In more detail, the solve method has an outer loop, indexed by i, thattraverses the nodes (locations) of the graph. For each iteration of theouter loop, an inner loop is executed to traverse the edges (arcs) ofthe graph and tracks whether the taking the current edge (arcs [j])would update the node values of the graph via a call to the relaxmethod.

The relax method determines if a candidate value of the edge-sourcenode's value (locations [u]) plus the current edge's weight (value) willincrease the current edge-destination node's value (locations [v]). Ifthe current edge-destination node's value will increase, the locations[v] value is set to the candidate value and a value of true (indicatingthe node values have been updated) is returned. If the currentedge-destination node's value will not increase, the locations [v] valueis unchanged and a value of false is returned, indicating the nodevalues have not been updated.

In the solve method, the assignment “changed=changed |relax ( . . . );”indicates that the value of the changed Boolean value, which isinitially set to be logical FALSE, is logically OR'd with the returnvalue of the relax function. That is, as long as the relax functionreturns logical FALSE values, the changed value will remain logicallyFALSE. However, once the relax function returns a logical TRUE value,the changed value will be set to and remain as logical TRUE throughoutthe remaining iterations of the inner loop of the solve method.

The list of edges of the graph is then traversed, using the inner loop,a total of up to |V|−1 times, where |V| is the number of nodes(vertices) in the graph. The Bellman-Ford algorithm can either terminatewith “valid” results if none of the node values are updated in anadditional pass through the list of edges, or “invalid” if at least onenode value is updated during the additional pass. The at least one nodevalue is updated only when positive cycles are part of the graph. Thus,the Bellman-Ford algorithm takes O(|V|* |E|) instructions, where |E| isthe number of edges.

The single-source longest path problem on a weighted digraph isequivalent to the much studied single-source shortest path problem onweighted digraph. The equivalence may be demonstrated as follows: givena weighted digraph G=(V, A) that includes of a set of directed arcs A,linking vertices, V; construct weighted graph, G′=(V, A′) where, for allarcs a′ in A′ and a in A:

source(a)=source(a),

destination(d)=destination(a), and

weight(a)=−weight(a).

A minimal path in G is a maximal path in G′ and vice versa. Algorithms,such as Bellman-Ford, that solve the shortest paths problem for arcswith both positive and negative weights may be deployed to solve thelongest path problem. Such use may be effected either by negating all ofthe weights in the graph or by changing the starting conditions andcomparator used in the relax function shown in Table 3 below from “<” to“>”. Where the algorithm is unmodified, its termination condition isunaffected. In the case where the algorithm is modified, the terminationcondition is correspondingly changed to reflect the properties of thenegated graph on which it is operating. The Bellman-Ford algorithmvariant modified to solve the single-source longest path problemterminates provided that its input contains no positive weight loops or“positive cycles.”

A positive cycle involves a path from a first node, N1 through one ormore other nodes, N2 . . . Nm, back to N1 with a sum of edge weightsalong the cycle being greater than 0; e.g., a positive weight path. Eachtraversal of the positive cycle can raise the benefit, or node value, oftraveling from the source node to one or more nodes along the positivecycle. As each traversal of the positive cycle raises the value of atleast some nodes, no maximum benefit for traveling from the source nodeto all other nodes can be determined, and thus the Bellman-Fordalgorithm variant as shown in Table 3 above will not solve thesingle-source longest-path problem.

FIG. 5 shows an example final graph 540, such as can be determined bythe solve method. FIG. 5 shows node X0 has a final value of 0, node X1has a value of 100, X2 and X3 each have a value of 260, and X4 has avalue of 360.

FIG. 6A shows scenario 300 continuing with a display of user-interface(UI) 610. User-interface 610 displays the components of user-interface310 utilizing the node values determined for final graph 540. Inparticular, text components 320 and 322 are shown aligned between gridlines X0 at 0 pixels from the origin and X4 at 360 pixels from theorigin, and text components 324 and 328 are shown aligned between gridlines X0 at 0 pixels and X1 at 100 pixels. Text entry regions 326 and330 are shown aligned between grid lines X1 at 100 pixels from theorigin and X2 at 260 pixels from the origin. Space component 332 is notshown in FIG. 6A as part of user-interface 610, as space component 332is a non-visible component. Buttons 334 and 336 are shown alignedbetween grid lines X3 at 260 pixels from the origin and X4 at 360 pixelsfrom the origin.

Scenario 300 continues with user-interface 610 being reduced in width by50 pixels, for a total reduced width of 310 pixels. For example, a userof user-interface 610 can shrink a window containing user-interface 310from at least 360 pixels wide down to 310 pixels wide. FIG. 6A showsthat the width of user-interface 610 with all components, includingspace component 332, having non-negative widths is 360 pixels.

The top portion of FIG. 6B shows resized user-interface 610 a with width310 pixels and superimposed grid lines X0-X4. As can be seen at the topof FIG. 6B, grid line X3 is shown at the rightmost edge, along with gridline X4, at 310 pixels from grid line X0 in user-interface 610 a. Assuch, FIG. 6B shows that buttons 334 and 336 have been truncated as the310-pixel width of user-interface 610 a is too small to show the entirewidths of the column that includes buttons 334 and 336.

Buttons 334 and 336 were truncated because (1) the layout did not permitviolation of the normal order for columns (e.g., Tables 1 and 1.1 do nothave a parameter setting such as columnOrderPreserved=“false”) and (2)the fourth column of user-interface 610 a, which contains buttons 334and 336, has an inflexible component, therefore making the columnnon-flexible.

Table 1 shows that the portion of the layout corresponding to buttons334 is as follows:

<Button

-   -   text=“Manual setup”    -   layout_row=“5”    -   layout_column=“3”

/>

As mentioned above, in the case where “gravity” or horizontal/verticalalignment is not explicitly defined, such as shown above for button 334,the layout manager can infer that the component is non-flexible.Further, the layout manager infers that elements aligned in a column areflexible if all of the elements in the column are flexible. Since button334 is an inflexible component, the layout manager infers that thefourth column of user-interface 610 a is inflexible and therefore has afixed width. Thus, the layout manager may partially or completelytruncate display of buttons 334 and 336 when a width of user-interface610 a is too small to show the entire width of the fourth column ofuser-interface 610 a.

Scenario 300 continues with user-interface 610 a being increased inwidth by 90 pixels, for a total width of 400 pixels. For example, a userof user-interface 610 a can expand a window containing user-interface610 a from 310 pixels wide to 400 pixels wide.

The bottom portion of FIG. 6B shows resized user-interface 610 b withwidth 400 pixels and superimposed grid lines X0-X4. As can be seen atthe bottom of FIG. 6B, grid line X3 is shown to the right of grid lineX2 in user-interface 610 b; that is, the grid lines of user-interface610 b are restored to the normal order.

As seen in FIG. 6B, for both user-interfaces 610 a and 610 b, textcomponents 324 and 328 are “left-justified” or aligned with theleft-most edge of respective user-interface 610 a or 610 b and buttons334 and 336 are “right-justified” or aligned with the right-most edge ofrespective user-interface 610 a or 610 b. Both the left justification ofcomponents 324 and 328 and the right justification of components 334 and336 is enabled by the adjustment of space 332 from a negative width of−50 pixels for user-interface 610 a to a positive width of 40 pixels foruser-interface 610 b.

By permitting the space component to be flexible, solutions to thelayout problem for the GridLayout element and sub-elements specified inTable 1 above can retain key features, such as left and rightjustification.

FIGS. 6C, 6D, and 6E show example user-interfaces based on heightconstraints on the example user-interface of FIG. 3, in accordance withan example embodiment.

The top portion of FIG. 6C depicts a grid 620 based on user-interface310. FIG. 6C shows that grid 620 includes grid lines X0-X4 and Y0-Y7 asshown in FIG. 3 and, more particularly, based on the GridLayout elementand sub-elements specified in Table 1 above. FIG. 6C also shows a set ofcomponents (C's) 402-418 depicted as grey rectangles that correspond tocomponents 320-336 of user-interface 310.

Table 4 shows the correspondence between user-interface components shownin FIG. 3 and grid components, height constraints, and edges in graph650 all shown in FIG. 6C.

TABLE 4 User-interface Grid Height Edge in Component ComponentConstraint Graph 650 Text 320 Component 402 Constraint 632 Edge 652 Text322 Component 404 Constraint 634 Edge 654 Text 324 Component 406Constraint 636 Edge 656 Text Entry Region 326 Component 408 Constraint638 Edge 658 Text 328 Component 412 Constraint 632 Edge 662 Text EntryRegion 330 Component 414 Constraint 644 Edge 664 Space 332 Component 410Constraint 640 Edge 660 Button 334 Component 416 Constraint 646 Edge 666Button 336 Component 418 Constraint 648 Edge 668

In particular, the spacing requirements between the rectangles ofuser-interface 310 can be re-expressed, as needed, so that there is noexcess space between components 402-418 of grid 620 of FIG. 6C. However,as shown in FIG. 6C, some or all of the components 402-418 of grid 620can overlap either partially or completely.

FIG. 6C shows each component 402-418 of grid 400 with a correspondingheight in pixels; for example, the text of user-interface component 320,and corresponding grid component 402, has been determined by the layoutmanager to fit within a component whose height is 30 pixels. As shown inFIG. 6C, grid 620 has a set of vertical grid lines {X0, X1 . . . X4} anda set of horizontal grid lines {Y0, Y1 . . . Y7}. In other scenarios,grid 400 can have only one set of grid lines (e.g., only vertical gridlines) or have more than two sets of grid lines (e.g., vertical,horizontal, and depth grid lines).

As such, each component 402-418 of grid 400 has at least fourproperties:

1. A minimum width (may be zero).

2. A minimum height (may be zero).

3. Two grid lines from the set of grid lines {X0 . . . X4} aligned withthe component's left and right edges.

4. Two grid lines from the set of grid lines {Y0 . . . Y7} are alignedwith the component's top and bottom edges.

As each component has a minimum height and is associated with two gridlines aligned with the component's top and bottom edges, a constraintcan be determined that corresponds to these properties. For example,grid 620 shows the top edge of component 402 aligned with grid line Y0,the bottom edge of component 402 aligned with grid line Y1, and a pixelvalue (shown in the middle of component 402) of 30 pixels, indicatingthat component 402 is at least 30 pixels high. These conditionscorrespond to constraint 632 of “Y1-Y0≧30” pixels.

As another example, grid 400 shows that the top edge of component 414 isaligned with grid line Y3, the bottom edge of component 414 is alignedwith grid line Y2, and a pixel value (shown in the middle of component414) of 12 pixels, indicating that component 414 is at least 12 pixelshigh. These conditions for component 414 correspond to constraint 644 of“Y4-Y3≧12” pixels.

The middle portion of FIG. 6C shows a set of constraints 632-648. Eachone of constraints 632-648 corresponds to one of components 402-418 ofgrid 620. As another example, constraint 640, which corresponds tocomponent 410, indicates that a location of the bottom edge (Y5) ofcomponent 410 has to be greater than or equal to a location of the topedge (Y2) of component 410. However, as component 410 is a flexiblecomponent, this constraint can permit relaxation of the normal orderingcondition for intervening grid lines Y3 and Y4, such as discussed belowin the context of FIG. 6D.

For each set of constraints, a graph can be determined with the nodescorresponding to the grid lines and the edges corresponding to theconstraints on the grid lines. The bottom portion of FIG. 6C shows graph650 with nodes shown as grey circles. Graph 650 has one node for eachhorizontal grid line Y0-Y7. Graph 650 also has edges (E) 652-668corresponding to constraints 630. Each edge 652-668 of graph 650corresponds to one of constraints 632-648, and as stated above, eachconstraint 632-648 corresponds to a component 402-418 of grid 620. Forexample, as shown in Table 4 above, edge 654 corresponds to bothcomponent 404 and constraint 634.

As the location of Y0 grid line can be pre-determined to be at theorigin, e.g., Y0=0, node Y0 of graph 650 can be designated as a sourcenode for the variant of the Bellman-Ford algorithm discussed above. Thevariant of the Bellman-Ford algorithm can operate on graph 650 todetermine the maximum height specified by each component in grid 620 andcorrespondingly, user-interface 310.

FIG. 6D continues scenario 300 by applying the variant of theBellman-Ford algorithm 520 for determining node values that solve thesingle-source longest path problem for graph 650. FIG. 6D shows finalgraph 670 with node values of: 0 for Y0, 30 for Y1, 45 for Y2, 60 forY3, 75 for Y4, 45 for Y5, 63 for Y6, and 78 for Y7. These node valuescan be considered as pixel values for grid lines Y0 through Y7 in layingout user-interface 680 a.

Recall from Tables 1 and 1.1 above, that the row order preservationparameter for the GridLayout element was set equal to “false” toindicate that the layout manager is permitted to relax the normal orderconstraint for the rows of the layout. Thus, as both (a) thecorresponding component and column are flexible and (b) the layoutpermits violation of the normal order condition for row ordering, thelayout manager can permit violation of the normal order condition forrows.

Additionally, recall that component 410 is a flexible component. Becausethe layout manager is permitted to relax the normal order condition forrows, the layout manager is permitted to interchange rows as long as theconstraint associated with component 410 is satisfied. Constraint 640,associated with component 410, indicates that Y5-Y2 must be greater thanor equal to zero. Thus, as shown in final graph 650, the node values ofnodes Y2 and Y5 are equal and set to 45 pixels. However, the node valuesof nodes Y3 and Y4, respectively 60 and 75 pixels, are greater than thenode value of node Y5, thus violating the normal order condition.However, as Y3 and Y4 are intervening grid lines for component 410—thatis, grid lines to that do not appear in a constraint related tocomponent 410, the normal order condition can be violated for theintervening grid lines, if (a) the corresponding component and column(for heights) or row (for widths) are flexible and (b) the layoutpermits violation of the normal order condition in the desireddirection.

Also, recall from Tables 1 and 1.4 above, that the layout_gravity forspace component 410 is specified to be “fill”; thus, a gravity in thevertical direction has been specified. Since gravity has been specifiedfor component 410, then the layout manager can infer component 410 isflexible. Since component 410 is flexible and the only component in thethird column of user-interface 300, the third column is a flexiblecolumn.

FIG. 6D shows a corresponding user-interface 680 a corresponding tofinal graph 670 with the normal order condition violated. That is, FIG.6D shows the row for button 334 overlapping with the row for text 324and text entry region 326 and shows the row for button 336 overlappingwith the row for text 328 and text entry region 330. Also, the rowheight between grid line Y4 (at 75 pixels) and Y5 (at 45 pixels) isnegative—this row height is −30 pixels, indicating the normal ordercondition was violated for the row between Y4 and Y5.

Scenario 300 continues with a resize operation that stretches the heightof user-interface 680 a to be 123 pixels tall. As such, FIG. 6D showseach of the four rows respectively displaying (i) text 324 and textentry region 326, (ii) text 328 and text entry region 330, (iii) button334, and (iv) button 336 without overlapping. Upon resizing,user-interface 680 a has a space of 18 pixels between grid line Y4,corresponding to the bottom of the row for text 328/text entry region330, and grid line Y5, corresponding to top of the row for button 334.

In a scenario not shown in the Figures, a resize operation that shrinksthe height of user-interface 680 a to be 78 pixels tall would lead touser-interface 680 a with the rows for buttons 334 and 336 overlappingthe respective rows for text 324 and text entry 326 and text 328 andtext entry 330. Thus, removing the normal order constraint permitsnegative spacing between some grid lines and permits solutions to thelayout problem with overlapping rows, columns, etc.

While the example shown in FIGS. 6C and 6D involves rows, in scenariosnot shown in the Figures, the normal order constraint can be relaxed inother dimensions to permit overlapping and negative width columns, topermit negative widths and overlapping slices along a Z or depth axis,and relaxed for other dimensions as well.

FIG. 6E shows graph 670 b, which is a variation of graph 670 where thenormal order condition for rows is preserved (i.e., not violated). Onetechnique to enforce the normal order is to add and enforce |V|normal-order constraints to the system of constraints. The |V|normal-order constraints can be of the form: Y₁−Y₀≧0, Y₂−Y₁≧0, . . .Y_(i+1)−Y_(i)≧0, . . . Y_(|V|)−Y_(|V|−1)≧0, with |V|−1>i>1 (for rows),or X₁−X₀≧0, X₂−X₁>0, . . . X_(i+1)≧0, . . . X_(|V|)−X_(|V|−1)≧0, with|V|−1>i>1 (for columns). Then, to relax the normal order for a subset ofcontiguous grid lines associated with rows, e.g., Y_(r1) . . . Y_(r2),where r1=the first relaxed grid line, and r2 is the last relaxed gridline, the corresponding normal-order constraints Y_(r1+1)−Y_(r1)≧0, . .. Y_(r2)−Y²⁻¹≧0 can be removed from the system of constraints.Similarly, to relax the normal order for a subset of contiguous gridlines associated with columns, e.g., X_(r1) . . . X_(r2), where r1=thefirst relaxed grid line, and r2 is the last relaxed grid line, thecorresponding normal-order constraints X_(r1+1)−X_(r1)≧0, . . .X_(r2)−X_(r2−1)>0 can be removed from the system of constraints.

FIG. 6E shows final graph 670 b, which is graph 670 of FIG. 6D with thenormal order preserved by setting node values for Y4 and Y5 equal to 75.Also, node values Y6 and Y7 are updated from those of graph 670 byadding the previous difference of 30 between node values for Y4 and Y5,to the respective node values of Y6 and Y7. User-interface 680 b of FIG.6E uses the node values from final graph 670 b, preserving the normalorder and is shown toward the bottom of FIG. 6E.

FIGS. 7A and 7B show an example scenario 700 with an example grid 710with some components whose sizes are specified using ranges, andcorresponding constraints 730, graph 750, final graph 770, anduser-interface (UI) 770.

In scenario 700, user-interface 310 has been modified to remove textcomponent 328, text entry region 330 and button 336. Also for scenario700, the specifications of text component 322 and button 334 have beenmodified to specify widths in terms of ranges of pixels rather thanusing fixed pixel amounts. As such, the top of FIG. 7A shows grid 710indicating (a) the width of text component 322 is specified as a rangeof pixel values 300-400, (b) no entries in grid 710 for text component328, text entry region 330 and button 336, (c) and the width of button334 is specified as a range of pixel values 100-132.

As mentioned above, the width of text component 322 is specified as arange of pixel values from a minimum of 300 pixels to a maximum of 400pixels. Text component spans from grid line X0 on the left to grid lineX4 on the right. Thus, the minimal and maximal constraints correspondingto this range of widths for text component 322 are:X4−X0≧300X4−X0≦400

To properly use both of these constraints on the same graph, bothconstraints should be the same kind of inequality; i.e., to use asingle-source longest-path algorithm, both constraints must be writtenin terms of greater than “>” or greater-than-or-equal “≧” signs, or touse a single-source shortest-path algorithm, both constraints must bewritten in terms of less than “<” or less-than-or-equal “≦” signs.

To use a single-source longest-path algorithm, the “X4−X0≦400”inequality can be rewritten as using a greater-than-or-equal sign bytaking the negative values of both sides of the inequality:“X0−X4≧−400.” Continuing with scenario 700, the middle of FIG. 7A showsconstraints 730 corresponding to grid 710. In particular, component 714of grid 710 has been translated into two constraints: constraint 734 awith X4−X0≧300, and constraint 734 b with X0−X4≧−400. Also, component726 has been translated into two constraints: constraint 746 a withX4−X3≧100 and constraint 746 b with X3−X4≧−132.

A directed-graph (or “digraph”) can be used in place of an undirectedgraph it is possible to accommodate two or more numbers (or weights),rather than one, in the characterization of the edge costs for edgesbetween two vertices A and B. The digraph allows graphs in which thecost or benefit of traveling from A to B may be different from the costor benefit of traveling from B to A, such as when a component, such ascomponent 714 or component 726, has a size that lies between a minimumand maximum value.

The bottom portion of FIG. 7A includes graph 750 corresponding toconstraints 730. In particular, edges 754 a and 754 b correspond torespective constraints 734 a and 734 b and edges 766 a and 766 bcorrespond to respective constraints 746 a and 746 b. Both edges 754 band 766 b can be classified as “backwards edges” as the destination nodeof each of these edges is associated with a smaller label than thesource node of each edge. For example, edge 754 b has a destination nodewith a label of X0 which is smaller than the label of the source node,which is X4. Also, both edges 754 b and 766 b have negative edgeweights; for edge 754 b, the edge weight is −400 and for edge 766 b, theedge weight is −132. In contrast, the remaining edges can be classifiedas “forward edges” as the destination node of each of these edges isassociated with a larger label than the source node of each edge.

FIG. 7B continues scenario 700 by applying the variant of theBellman-Ford algorithm for determining node values that solve thesingle-source longest-path problem for graph 750. FIG. 7B shows graph770 with node values of: 0 for X0, 100 for X1, 260 for X2 and X3, and360 for X4. These node values can be considered as pixel values for gridlines X0 through X4 in laying out user-interface 780.

FIG. 7B shows, at the bottom, scenario 700 continuing with a display ofuser-interface (UI) 780. User-interface 780 displays the components ofuser-interface 310 that were selected for inclusion in, and invoking theconstraints of grid 710, as well as utilizing the node values determinedfor final graph 770. In particular, text components 320 and 322 areshown aligned between grid lines X0 at 0 pixels from the origin and X4at 360 pixels from the origin, and text component 324 is shown alignedbetween grid lines X0 at 0 pixels and X1 at 100 pixels. Text entryregion 326 is shown aligned between grid lines X1 at 100 pixels from theorigin and X2 at 260 pixels from the origin. Space component 332 is notshown in FIG. 7B as part of user-interface 770, as space component 332is a non-visible component. Button 334 is shown aligned between gridlines X3 at 260 pixels from the origin and X4 at 360 pixels.

Reliable Bellman-Ford Variants

Some layouts lead to sets of constraints that are mutually inconsistent.An example on a desktop system might be the shrinking of a window to asize smaller than is necessary to display all of the containedcomponents at their minimum size. The standard Bellman-Ford algorithmcan detect this condition but reports failure in this case withoutreturning a usable solution.

The contract for a constraint solver can be modified to specify theintended behavior in the case of inconsistencies, such as inconsistentconstraints, by modifying the graph to remove edges, and thereforeconstraints, that may lead to the inconsistencies. The followingpseudo-code for a modified Bellman-Ford algorithm can operate withinconsistent constraints:

0. Place the edges of the graph provided to the modified Bellman-Fordalgorithm into an ordered list. The order of edges within the orderedlist can indicate priority associated constraints, where higher-priorityedges precede lower-priority edges in the list. Also, associate aBoolean culprit value C_(i) with each edge of the graph E_(i) thatindicates whether or not the relax function of the Bellman-Fordalgorithm of Table 3 above, operating on edge E_(i), returned a logicalTRUE value at any point during the execution of the Bellman-Fordalgorithm. The C_(i) values can be initialized to logical FALSE. The useof the term “list” does not imply a particular data structure; rather,any data structure configurable to perform the actions described hereinfor the ordered list can be used as a data structure for the orderedlist.

For example, consider graph 440 of FIG. 4. Graph 440 has 9 edges witheach edge 442-458 associated with a respective constraint 422-438. Then,place the edges 442-458 into the ordered list, where the first edge inthe ordered list is the highest priority edge of graph 440, the secondedge in the ordered list is the second-highest priority edge of graph440, and so on down to the ninth edge in the ordered list being thelowest priority edge of graph 440. Each of the nine edges can beassociated with a culprit value C_(i) initially set to FALSE, with iranging from 1 to 9.

1. Initialize each node value in the graph provided to the modifiedBellman-Ford, using a common value of 0 for all nodes.

2. Run the Bellman-Ford algorithm.

3. If the Bellman-Ford algorithm reports success, exit.

4. Set each culprit value C_(i) to FALSE.

5. Run the Bellman-Ford algorithm again without reinitializing nodevalues, and permanently setting a culprit value C_(i) to TRUE when therelax function of the Bellman-Ford algorithm of Table 3 above, operatingon edge E_(i), returns a logical TRUE value, indicating that edge E_(i)was used to update a node value.

6. Find the largest value LV for which the corresponding culprit valueC_(LV) is set to TRUE. Then, for the largest value LV found, remove edgeE_(LV) from the graph as a culprit edge. In some embodiments, a signalcan be provided to software and/or hardware components that auser-interface constraint, corresponding to culprit edge E_(LV) wasremoved. In some scenarios, the removed user-interface constraint can berelated to a size of a window displaying the user-interface. Forexample, the removed user-interface constraint may indicate thedisplaying window is too small to show the entire user-interface,perhaps triggering a change in window size, addition of scroll bars, orsome other action. Other signals and/or actions are possible as well.

7. Repeat from Step 1.

8. End.

Faster Bellman-Ford Variants

To increase performance of the variant of the Bellman-Ford algorithmshown in Table 3 above, the list of edges (arcs) can be topologicallysorted prior to calling the solve method. A topological sort of a listof edges E is an ordering of a list of nodes N of a graph G such that ifan edge E(u, v) is an edge from node u to node v, with u, v in N, ucomes before v in the ordering of the list of nodes N.

For example, initial graph 500 and final graph 540 of FIG. 5, one listof vertices is {X0, X1, X2, X3, X4}. Thus, an example topologicallysorted list of edges of either graph 500 or 540, can be {E(X0, X1, 100),E(X0, X1, 80), E(X1, X2, 160), E(X1, X2, 130), E(X2, X3, 0), E(X0, X4,160), E(X0, X4, 300), E(X3, X4, 100), E(X3, X4, 50)}, where E(u, v, v′)is the edge of graph 500 or 540 from node u to node v with value v′.Other topologically sorted lists of edges are possible as well.

The list of edges can be split into two portions: a forward-edge portionincluding all and only forward edges and a backward-edge portionincluding all and only backward edges. When topologically sorting thelist of edges, each portion can be separately topologically sorted. Thatis, the forward edges of the forward-edge portion can be topologicallysorted separately from the backwards edges of the backward-edge portion.Then, after the separate topological sorts, the two portions can berejoined into the list of edges. The rejoined list of edges can beordered so that each edge in the forward-edge portion precedes all edgesof the backward-edge portion. Thus, the backward edges have higherindices in the list of edges.

Then, by processing topologically sorted lists of edges, the solvemethod typically determines node values for all nodes in the graph usingtwo iterations of the outer loop: one iteration to have the inner loopdetermine the node values based on the topologically sorted list ofedges, and a second iteration to have the inner loop determine that thenode values did not change. When the node values do not change during aniteration of the inner loop, the changed variable of the solve methodwill be logically FALSE, and thus the outer loop will be terminatedusing the break statement.

Typically, when the solve method shown in Table 3 is executed usingseparated forward and backward-edge portions, and with each portionbeing separately topologically sorted, the solve method will take aconstant number of outer loop iterations.

As discussed above, each outer loop iteration requires O(|E|) iterationsof the inner loop. As each inner loop involves O(1) instructions, theO(|E|) iterations of the inner loop take O(|E|) instructions. Thus, thesolve method shown in Table 3 using separated forward and backward-edgeportions, each portion being separately topologically sorted, willtypically require O(|E|) instructions.

Example Operations

FIGS. 8-15 are flow charts that illustrate various example embodiments.These embodiments may involve and/or be performed by a computing device,such as a programmable device or server device shown in FIG. 1, acomputing device shown in FIG. 2A, and/or a computing cluster shown inFIG. 2B. Descriptions of these embodiments may be read in context of thediscussion of FIGS. 3-7B, above.

FIG. 8 is a flow chart of method 800, in accordance with an exampleembodiment. Method 800 begins at block 810, where a computing device canreceive a layout. The layout can be configured to specify at least a setof rectangular components within a container rectangle. Each rectangularcomponent can have at least one size in at least one dimension.

At block 820, the computing device can determine a plurality of gridlines from the layout. Each rectangular component of the set ofrectangular components can be associated with at least two grid lines ofthe plurality of grid lines. The at least two grid lines can be based onthe at least one size of the rectangular component.

In some embodiments, the layout can be configured to specify at least aspace component as a component in the set of rectangular components. Inother embodiments, the layout is configured to specify a flexibility ofat least one rectangular component in the set of rectangular components.In even other embodiments, the layout can be configured to specify atleast a GridLayout element.

At block 830, the computing device can generate a system of constraints.Each constraint of the system of constraints can be related to at leasttwo grid lines of the plurality of grid lines.

At block 840, the computing device can solve the system of constraints.The computing device can determine, for each grid line in the pluralityof grid lines, a location for the grid line.

In some embodiments, solving the system of constraints to determine, foreach grid line in the plurality of grid lines, the location for the gridline includes: (a) labeling each grid line in the plurality of gridlines with a label, (b) ordering the plurality of grid lines based onthe label; and (c) utilizing a normal ordering of the grid lines basedon the ordering of the plurality of grid lines, such as discussed abovein the context of at least FIGS. 6A and 6B.

In other embodiments, the set of components includes a non-visiblecomponent. In these other embodiments, solving the system of constraintsto determine, for each grid line in the plurality of grid lines, thelocation for the grid line includes: (a) determining two or more gridlines associated with the non-visible component, and (b) relaxing thenormal ordering of the grid lines for at least the two or more gridlines associated with the non-visible component such as discussed abovein the context of at least FIGS. 6A and 6B.

In some embodiments, solving the system of constraints to determine, foreach grid line in the plurality of grid lines, a location for the gridline includes: (a) generating a graph including a plurality of nodes anda plurality of edges, where the plurality of nodes correspond to theplurality of grid lines, and where the plurality of edges correspond tothe system of constraints, and (b) solving a single-source path-lengthproblem for the graph to determine the locations for the grid lines.

In some embodiments, solving the single-source path-length problem forthe graph to determine the locations for the grid lines can includesolving the single-source path-length problem using a variant of theBellman-Ford algorithm.

In some embodiments: (a) the graph can be a directed graph, (b) at leasta first and a second edge of the plurality of edges can be respectivelyassociated with a first constraint and a second constraint of the systemof constraints, (c) both the first and second constraints can beassociated with a single rectangular component of the set of rectangularcomponents, (d) the first constraint can include a constraint on aminimum value for the single rectangular component, (e) the secondconstraint can include a constraint on a maximum value for the singlerectangular component, and (f) a direction of the first edge can differfrom a direction of the second edge, such as discussed above in thecontext of at least FIGS. 7A and 7B.

In particular embodiments, method 800 can include: (g) separating theplurality of edges into at least a first portion of edges and a secondportion of edges, where the first edge is in the first portion, wherethe second edge is in the second portion, where a direction of each edgein the first portion is the direction of the first edge, and where adirection of each edge in the second portion is the direction of thesecond edge, (h) topologically sorting the first portion of edges, (i)topologically sorting the second portion of the plurality of edgesseparately from the first portion of edges, and (j) solving thesingle-source path-length problem using a variant of the Bellman-Fordalgorithm operating upon the topologically-sorted first portion of edgesand the topologically-sorted second portion of edges, such as discussedabove.

In more particular embodiments, solving the single-source path-lengthproblem using the variant of the Bellman-Ford algorithm operating uponthe topologically-sorted first portion of edges and thetopologically-sorted second portion of edges includes: (k) generating anordering of the plurality of edges, where each edge in thetopologically-sorted first portion of edges precedes each edge in thetopologically-sorted second portion of edges; (l) generating a orderedplurality of edges, including at least the topologically-sorted firstportion of edges and the topologically-sorted second portion of edges,based on the ordering of the plurality of edges; and (m) solving thesingle-source path-length problem using a variant of the Bellman-Fordalgorithm operating upon the ordered plurality of edges.

In still more particular embodiments, solving the single-sourcepath-length problem using a variant of the Bellman-Ford algorithmoperating upon the ordered plurality of edges includes: (n) after usingthe variant of the Bellman-Ford algorithm, determining that there areone or more inconsistent constraints in the system of constraints, (o)identifying one or more culprit edges in the ordered plurality of edgescorresponding to the one or more inconsistent constraints; and (p)removing a highest-ordered culprit edge of the one or more culprit edgesfrom the ordered plurality of edges.

In other embodiments, solving the single-source path-length problem forthe graph to determine the locations for the grid lines includes solvingthe single-source path-length problem using a variant of theBellman-Ford algorithm. Solving the single-source path-length problemusing a variant of the Bellman-Ford algorithm can include topologicallysorting at least a portion of the plurality of edges prior to invokingthe variant of the Bellman-Ford algorithm.

At block 850, the computing device can generate a display of at leastsome of the set of rectangular components based on the locations of thegrid lines.

In some embodiments, the computing device can display the display of theleast some of the set of rectangular components. In some embodiments, acomputing device that generated the display of the at least some of theset of rectangular components can display the at least some of the setof rectangular components on a display associated with the computingdevice. In other embodiments, the computing device that generated thedisplay of the at least some of the set of rectangular components cantransmit the display to another computing device for the anothercomputing device to display on a display associated with the anothercomputing device.

FIG. 9 is a flow chart of a method 900, in accordance with an exampleembodiment. Method 900 begins at block 910, where a computing device canreceive a user-interface layout. The user-interface layout can beconfigured to specify at least first rectangular component and a secondrectangular component, both within a container rectangle. The firstrectangular component can have a first size in a horizontal or verticaldimension, and the second rectangular component can have a second sizein the horizontal or vertical dimension.

In some embodiments, the first rectangular component can have the firstsize and a third size, where the first size is in the horizontaldimension, and where the third size is in the vertical dimension.

At block 920, the computing device can determine a plurality of gridlines based on the user-interface layout. The first rectangularcomponent can be associated with a first set of at least two grid linesof the plurality of grid lines, and the second rectangular component canbe associated with a second set of at least two grid lines of theplurality of grid lines.

In some embodiments, determining the plurality of grid lines based onthe user-interface layout can include determining the first set of atleast two grid lines of the plurality of grid lines based on the firstsize and determining a third set of at least two grid lines of theplurality of grid lines based on the third size.

At block 930, the computing device can generate a system of constraints.A first constraint in the system of constraints can be related to thefirst set of at least two grid lines, and a second constraint in thesystem of constraints can be related to the second set of at least twogrid lines.

In some embodiments, the system of constraints can include a horizontalsystem of constraints and a vertical system of constraints. Inparticular embodiments, the horizontal system of constraints can includeat least one constraint based on the first set of at least two gridlines, and the vertical system of constraints can include at least oneconstraint based on the third set of at least two grid lines.

At block 940, the computing device can solve the system of constraintsto determine, for each respective grid line in the first and second setsof grid lines, a respective location for the respective grid line.

In some embodiments, solving the system of constraints includes: (a)generating a graph including a plurality of nodes and a plurality ofedges, where the plurality of nodes correspond to the plurality of gridlines, and where the plurality of edges correspond to the system ofconstraints, and (b) using a variant of a Bellman-Ford algorithm tosolve a single-source path-length problem for the graph to determine thelocations for the grid lines.

In other embodiments, solving the system of constraints includes: (c)solving the horizontal system of constraints to determine a plurality ofhorizontal locations and (d) solving the vertical system of constraintsto determine a plurality of vertical locations. In particularembodiments, solving the horizontal system of constraints includessolving the horizontal system of constraints independently from solvingthe vertical system of constraints. In other particular embodiments, theplurality of horizontal locations includes a location for eachrespective grid line in the first set of at least two grid lines, andthe plurality of vertical locations includes a location for eachrespective grid line in the third set of at least two grid lines.

At block 950, the computing device, based on the respective locations ofthe respective grid lines, can generate a user-interface display toinclude the first and second rectangular components.

In some embodiments, generating the user-interface display including thefirst and second rectangular components includes generating theuser-interface display with the first component horizontally locatedbased on the locations of the grid lines in the first set of at leasttwo grid lines and vertically located based on the locations of the gridlines in the third set of at least two grid lines.

At block 960, a computing device can display the user-interface display.

FIG. 10 is a flow chart of a method 1000, in accordance with an exampleembodiment. Method 1000 begins at block 1010, where a computing devicecan receive a layout. The layout can be configured to specify at least aset of rectangular components within a container rectangle. Eachrectangular component can have at least one size in at least onedimension.

In some embodiments, a particular rectangular component of the set ofrectangular components can have at least a particular-component heightand a particular-component width. In particular embodiments, theparticular rectangular component additionally has at least aparticular-component depth.

In other particular embodiments, the plurality of grid lines can includea plurality of horizontal grid lines and a plurality of vertical gridlines. The particular rectangular component can be associated with atleast two horizontal grid lines of the plurality of horizontal gridlines that are related to the particular-component height. Theparticular rectangular component can be associated with at least twovertical grid lines of the plurality of vertical grid lines that arerelated to the particular-component width. The system of constraints caninclude a system of horizontal constraints corresponding to theplurality of horizontal grid lines and a system of vertical constraintscorresponding to the plurality of vertical grid lines.

In more particular embodiments, generating the graph can include: (a)generating a first graph associated with the plurality of horizontalgrid lines and the system of horizontal constraints and (b) generating asecond graph associated with the plurality of vertical grid lines andthe system of vertical constraints. Then, solving the single-sourcepath-length problem for the graph can include: (c) solving a firstsingle-source path-length problem for the first graph to determinelocations for the plurality of horizontal grid lines and (d) solving asecond single-source path-length problem for the second graph todetermine locations for the plurality of vertical grid lines. Also,generating the display can include generating a display of at least someof the set of rectangular components based on the locations for theplurality of horizontal grid lines and the locations for the pluralityof vertical grid lines.

At block 1020, the computing device can determine a plurality of gridlines from the layout. Each rectangular component of the set ofrectangular components can be associated with at least two grid lines ofthe plurality of grid lines. The at least two grid lines can be based onthe at least one size of the rectangular component.

At block 1030, the computing device can generate a system ofconstraints. Each constraint of the system of constraints can be relatedto at least two grid lines of the plurality of grid lines.

At block 1040, the computing device can generate a graph including aplurality of nodes and a plurality of edges. Each node can be associatedwith a node value. The plurality of nodes can correspond to theplurality of grid lines. The plurality of edges can correspond to thesystem of constraints.

In some embodiments: (a) the graph can be a directed graph, (b) at leasta first and a second edge of the plurality of edges can be respectivelyassociated with a first constraint and a second constraint of the systemof constraints, (c) both the first and second constraints can beassociated with a single rectangular component of the set of rectangularcomponents, (d) the first constraint can include a constraint on aminimum value for the single rectangular component, (e) the secondconstraint can include a constraint on a maximum value for the singlerectangular component, and (f) a direction of the first edge can differfrom a direction of the second edge.

At block 1050, the computing device can topologically sort the pluralityof edges.

In particular embodiments, topologically sorting the plurality of edgescan include: (a) separating the plurality of edges into at least a firstportion of edges and a second portion of edges, where the first edge isin the first portion, where the second edge is in the second portion,where a direction of each edge in the first portion is the direction ofthe first edge, and where a direction of each edge in the second portionis the direction of the second edge, (b) topologically sorting the firstportion of edges.

At block 1060, the computing device can determine locations for the gridlines by solving a single-source path-length problem for the graph. Thesingle-source path-length problem can be solved using a variant of theBellman-Ford algorithm that is configured to operate with thetopologically-sorted plurality of edges.

In some embodiments, solving the single-source path-length problem forthe graph using the variant of the Bellman-Ford algorithm configured tooperate with the topologically-sorted plurality of edges can includesolving the single-source path-length problem using a variant of theBellman-Ford algorithm operating upon the topologically-sorted firstportion of edges and the topologically-sorted second portion of edges.

In particular embodiments, solving the single-source path-length problemusing the variant of the Bellman-Ford algorithm operating upon thetopologically-sorted first portion of edges and the topologically-sortedsecond portion of edges can include: (a) generating an ordering of theplurality of edges, where each edge in the topologically-sorted firstportion of edges precedes each edge in the topologically-sorted secondportion of edges, (b) generating an ordered plurality of edges,including at least the topologically-sorted first portion of edges andthe topologically-sorted second portion of edges, based on the orderingof the plurality of edges, and (c) solving the single-source path-lengthproblem using a variant of the Bellman-Ford algorithm operating upon theordered plurality of edges.

In yet other embodiments, the variant of the Bellman-Ford algorithmconfigured to operate with the topologically-sorted plurality of edgescan include an inner loop and an outer loop. The outer loop can beconfigured to traverse the plurality of nodes. The inner loop can beconfigured to traverse a plurality of edges associated with a node ofthe plurality of nodes and determine whether at least one node weighthas changed during traversal of the plurality of edges associated withthe node. In particular embodiments, the outer loop can be configured toterminate upon determining that at least one node weight has not changedduring traversal of the plurality of edges associated with the node.

At block 1070, the computing device can generate a display of at leastsome of the set of rectangular components based on the locations of thegrid lines.

In some embodiments, the computing device can display the display of theleast some of the set of rectangular components.

FIG. 11 is a flow chart illustrating method 1100, in accordance with anexample embodiment. Method 1100 begins at block 1110, where a computingdevice can receive a layout. The layout can be configured to specify atleast a set of rectangular components within a container rectangle. Eachrectangular component of the set of rectangular components can have atleast one size in at least one dimension. The set of rectangularcomponents can include a space component configured to be non-visibleand configured not to react to user-interface events.

At block 1120, the computing device can determine a plurality of gridlines from the layout. Each rectangular component of the set ofrectangular components can be associated with at least two respectivegrid lines of the plurality of grid lines. The at least two respectivegrid lines can be based on the at least one size of the rectangularcomponent.

At block 1130, the computing device can generate a system ofconstraints. Each respective constraint of the system of constraints canbe related to at least two respective grid lines of the plurality ofgrid lines.

At block 1140, the computing device can solve the system of constraintsto determine, for each grid line of the plurality of grid lines, alocation for the grid line.

In some embodiments, solving the system of constraints can includesolving the system of constraints using a variant of the Bellman-Fordalgorithm.

At block 1150, the computing device can generate a display of at leastsome of the set of rectangular components based on the locations of thegrid lines.

In some embodiments, the computing device can display the at least someof the respective rectangular components, where the space component canbe displayed transparently.

In other embodiments, the user-interface events can include clicks,taps, mouse-overs, and pinch-gestures.

In still other embodiments, the space component is configured using oneor more parameters. In particular embodiments, the one or moreparameters include a row parameter, a column parameter, a gravityparameter, and combinations thereof.

In yet other embodiments, each component in the set of rectangularcomponents can be associated with a widget. In particular embodiments,each widget associated with a component in the set of rectangularcomponents can inherit from a common super-class. In more particularembodiments, the widget associated with the space component can have aclass that is a sub-class of the common super-class.

In some embodiments, the space component is configured to be a flexiblecomponent. In particular embodiments, a request to resize the display ofat least some of the set of rectangular components can be received; andin response to the request to resize the display, the flexible spacecomponent can be resized. In more particular embodiments, resizing theflexible space component includes relaxing a normal order condition forthe flexible space component. In still more particular embodiments, thedisplay can be resized, where at least one pair of rows or columns ofthe display overlap based on the flexible space component.

FIG. 12 is a flow chart of method 1200, in accordance with an exampleembodiment. Method 1200 begins at block 1210, where a layout can bereceived at a computing device. The layout can be configured to specifyat least a set of rectangular components within a container rectangle.Each rectangular component can have at least one size in at least onedimension.

At block 1220, the computing device can determine a plurality of gridlines from the layout. Each rectangular component of the set ofrectangular components can be associated with at least two grid lines ofthe plurality of grid lines. The at least two grid lines can be based onthe at least one size of the rectangular component.

In some embodiments, the plurality of grid lines can include n+1 gridlines Y0, Y1, . . . , Yn with n>0. Each of the n+1 grid lines cancorrespond to constraints on rows in the display. In particularembodiments, the one or more normal-order constraints can include n+1constraints of the form Y_(i+1)−Y_(i)>0, where i is an integer between 0and n−1, inclusive.

In other embodiments, the plurality of grid lines can include m+1 gridlines X0, X1, . . . , Xm with m>0. Each of the m+1 grid lines cancorrespond to constraints on columns in the display. In particularembodiments, the one or more normal-order constraints can include m+1constraints of the form X_(i+1)−X_(i)≧0, where i is an integer between 0and m−1, inclusive.

At block 1230, the computing device can generate a system ofconstraints. The system of constraints can include one or morenormal-order constraints. Each constraint of the system of constraintscan be related to at least two grid lines of the plurality of gridlines. The one or more normal-order constraints can specify a normalorder for the plurality of grid lines.

At block 1240, the computing device can solve the system of constraintsto determine, for each grid line of the plurality of grid lines, a firstlocation for the respective grid line.

In some embodiments, solving the system of constraints can includesolving the system of constraints using a variant of the Bellman-Fordalgorithm.

At block 1250, the computing device can identify at least one relaxablenormal-order constraint of the one or more normal-order constraints.

At block 1260, the computing device can solve the system of constraintsbased on relaxing the at least one relaxable normal-order constraint todetermine, for each grid line in the plurality of grid lines, a secondlocation for the grid line. The second location can differ from thefirst location for at least one relaxed grid line in the plurality ofgrid lines.

In some embodiments, the second location for the at least one relaxedgrid line can be less than the first location for the at least onerelaxed grid line.

In other embodiments, relaxing the at least one relaxable normal-orderconstraint can include removing the at least one relaxable normal-orderconstraint from the system of constraints.

In particular embodiments, solving the system of constraints can includesolving the system of constraints using a variant of the Bellman-Fordalgorithm.

At block 1270, the computing device can generate a display of at leastsome of the set of rectangular components based on the second locationsof the grid lines.

In some embodiments, the display of at least some of the set ofrectangular components can have at least one row with a negative height,where the at least one row having the negative height is associated withthe at least one relaxed grid line. In particular embodiments, at leasttwo rows in the display can overlap based on the negative height.

In other embodiments, the display of at least some of the set ofrectangular components can have at least one column with a negativewidth, where the at least one column having the negative width isassociated with the at least one relaxed grid line. In particularembodiments, at least two columns in the display can overlap based onthe negative width.

At block 1280, the computing device can display the display.

FIG. 13 is a flow chart of method 1300, in accordance with an exampleembodiment. Method 1300 begins at block 1310, where a layout can bereceived at a computing device. The layout can be configured to specifya set of rectangular components within a container rectangle. Eachrectangular component can have a size in at least one dimension. Eachrectangular component can be configured with a gravity parameter. Eachrectangular component can be classified as flexible or non-flexiblebased on the gravity parameter for the rectangular component.

In some embodiments, the gravity parameter can be specified for at leastone dimension, and the particular component can be classified asflexible in the at least one dimension.

In other embodiments, the gravity parameter can be unspecified in atleast one dimension, and the particular component can be classified asnon-flexible in the at least one dimension.

At block 1320, the computing device can determine a plurality of gridlines from the layout. Each rectangular component of the set ofrectangular components can be associated with at least two grid lines ofthe plurality of grid lines. The at least two grid lines are based onthe at least one size of the rectangular component;

At block 1330, the computing device can generate a system ofconstraints. Each respective constraint of the system of constraints canbe related to at least two respective grid lines of the plurality ofgrid lines.

At block 1340, the computing device can solve the system of constraintsto determine, for each grid line of the plurality of grid lines, alocation for the grid line.

At block 1350, the computing device can generate a display of at leastsome of the set of rectangular components, based on the locations of therespective grid lines, a user-interface display of at least some of theset of rectangular components may be generated.

In some embodiments, the container rectangle can be divided into one ormore columns. Each column of the one or more columns can be classifiedas flexible or non-flexible, and can have a width that is eithernegative or non-negative. A flexible column can be configured to have awidth that is either negative or non-negative, and a non-flexible columncan be configured to have only a non-negative width.

In particular embodiments, a subset of the set of rectangular componentscan be aligned in a particular column of the one or more columns. Eachcomponent in the subset of rectangular components can be classified asflexible, and the given column can be classified as flexible.

In other particular embodiments, a subset of the set of rectangularcomponents can be aligned in a particular column of the one or morecolumns. At least one rectangular component in the subset of rectangularcomponents can be classified as non-flexible, and the given column canbe classified as non-flexible.

In some other particular embodiments, at least one column of the one ormore columns can be classified as flexible. A particular flexible columnof the at least one flexible column can have a negative width. At leastsome of the one or more columns can overlap on the display based on theparticular flexible column.

In yet other embodiments, the container rectangle can be divided intoone or more rows. Each row of the one or more rows can be classified asflexible or non-flexible, and can have a height that is either negativeor non-negative. A flexible row can be configured to have a height thatis either negative or non-negative, and a non-flexible row can beconfigured to have only a non-negative height.

In yet other particular embodiments, a subset of the set of rectangularcomponents can be aligned in a particular row of the one or more rows.Each component in the subset of rectangular components can be classifiedas non-flexible, and the given row can be classified as non-flexible.

In still other particular embodiments, a subset of the set ofrectangular components can be aligned in a particular row of the one ormore rows. At least one rectangular component in the subset ofrectangular components can be classified as flexible, and the given rowcan be classified as flexible.

In other particular embodiments, at least one row of the one or morerows can be classified as flexible. A particular flexible row of the atleast one flexible row can have a negative height. At least some of theone or more rows can overlap on the display based on the particularflexible row.

FIG. 14 is a flow chart of an example method 1400, in accordance with anexample embodiment. Method 1400 begins at block 1410, where a layout canbe received at a computing device. The layout can be configured tospecify at least a set of rectangular components within a containerrectangle. Each rectangular component can have at least one size in atleast one dimension.

At block 1420, the computing device can determine a plurality of gridlines from the layout. Each rectangular component of the set ofrectangular components can be associated with at least two grid lines ofthe plurality of grid lines. The at least two grid lines can be based onthe at least one size of the rectangular component.

At block 1430, the computing device can generate a system ofconstraints. The system of constraints can include a minimum constraintand a maximum constraint. The minimum constraint can specify a minimumdistance between two given grid lines, and the maximum constraint canspecify a maximum distance between the two given grid lines.

In some embodiments, both the minimum and maximum constraints can beassociated with a single rectangular component of the set of rectangularcomponents. The single rectangular component can be associated with afirst grid line of the plurality of grid lines and a second grid line ofthe plurality of grid lines. In particular embodiments, the minimumconstraint can include a constraint on a minimum value for the singlerectangular component, and the maximum constraint can include aconstraint on a maximum value for the single rectangular component.

At block 1440, the computing device can solve the system of constraintsto determine, for each grid line of the plurality of grid lines, alocation for the respective grid line.

In some embodiments, solving the system of constraints can include:generating a graph including a plurality of nodes and a plurality ofedges, where the plurality of nodes correspond to the plurality of gridlines, where the plurality of edges correspond to the system ofconstraints, where at least a minimum edge and a maximum edge of theplurality of edges are respectively associated with the minimumconstraint and the maximum constraint of the system of constraints, andwhere the minimum edge has a first direction and the maximum edge has asecond direction that differs from the first direction. In particularembodiments, a first node of the plurality of nodes corresponds to thefirst grid line, a second node of the plurality of nodes corresponds tothe second grid line, the minimum edge is a forward edge from the firstnode to the second node, and the maximum edge is a backward edge fromthe second node to the first node.

In more particular embodiments, solving the system of constraints caninclude: (a) determining a first node weight for the first node, (b)determining a second node weight for the second node, and (c)determining a difference between the second node weight and the firstnode weight that is between the minimum value and the maximum value.

At block 1450, the computing device can generate a display of at leastsome of the set of rectangular components based on the locations of thegrid lines.

In some embodiments, generating the display can include determining afirst location based on the first node weight and a second locationbased on the second node weight. Then, the single rectangular componentcan be displayed in the display between the first location and thesecond location.

In some embodiments, method 1400 can include: separating the pluralityof edges into at least a first portion of edges and a second portion ofedges, where the minimum edge is in the first portion, where the maximumedge is in the second portion, where each edge in the first portion isin the first direction, and where each edge in the second portion is inthe second direction.

In particular of these embodiments, method 1400 can further include: (a)sorting the first portion of edges, (b) sorting the second portion ofedges separately from the first portion of edges, and (c) joining thefirst and second portions of edges. In more particular of theseembodiments, method 1400 can further include: generating an ordering ofthe plurality of edges, where each edge in the first portion of edgesprecedes each edge in the second portion of edges, and where joining thefirst and second portions of edges includes joining the first and secondportions of edges into a joined list of edges so that each edge in thefirst portion of the joined list precedes all edges of the secondportion of edges in the joined list. In even more particular of theseembodiments, solving the system of constraints can include solving thesingle-source path-length problem using a variant of the Bellman-Fordalgorithm operating upon the joined list.

FIG. 15 is a flow chart of an example method 1500, in accordance with anexample embodiment. Method 1500 begins at block 1510, where a layout canbe received at a computing device. The layout can be configured tospecify at least a set of rectangular components within a containerrectangle. Each rectangular component can have at least one size in atleast one dimension.

At block 1520, the computing device can determine a plurality of gridlines from the layout. Each rectangular component of the set ofrectangular components can be associated with at least two grid lines ofthe plurality of grid lines. The at least two grid lines can be based onthe at least one size of the rectangular component.

At block 1530, the computing device can generate a system ofconstraints. Each constraint of the system of constraints can be relatedto at least two grid lines of the plurality of grid lines. The system ofconstraints can include inconsistent constraints.

At block 1540, the computing device can generate a graph including aplurality of nodes and a plurality of edges. Each node of the pluralityof nodes can be associated with a node value. The plurality of nodes cancorrespond to the plurality of grid lines. The plurality of edges cancorrespond to the system of constraints.

At block 1550, a single-source path-length problem for the graph can besolved to determine locations for the grid lines. The single-sourcepath-length problem for the graph can be solved using a variant of theBellman-Ford algorithm configured to operate with the inconsistentconstraints.

In some embodiments, the variant of the Bellman-Ford algorithm isfurther configured to at least: (a) place the plurality of edges of thegraph into an ordered list, where higher-priority edges precedelower-priority edges in the list, (b) initialize each node value for theplurality of nodes to a common value, (c) attempt to solve asingle-source path-length problem on the graph; and (d) determinewhether a successful outcome to the single-source path-length problemoccurs. In particular of these embodiments, the variant of theBellman-Ford algorithm can be exited in response to determining that thesuccessful outcome does occur.

At block 1560, the computing device can generate a display of at leastsome of the set of respective rectangular components based on thelocations for the grid lines.

In some embodiments, generating the display can include generating thedisplay for display within a window, where the display has one or moredisplay sizes, where the window has one or more window sizes, and whereat least one display size of the one or more display sizes is greaterthan a corresponding at least one window size of the one or more windowsizes. In particular of these embodiments, at least one of theinconsistent constraints corresponds to the at least one display size ofthe one or more display sizes that is greater than the corresponding atleast one window size of the one or more window sizes.

In some embodiments, method 1500 can further include, in response todetermining that the successful outcome does not occur: (a) associatinga culprit value C_(i) with each edge E_(i) in the ordered list, theculprit value C_(i) initially assigned to a logical false value; (b)attempting to solve the single-source path-length problem on the graphwithout reinitializing each node value for the plurality of nodes, andassigning a culprit value C_(i) for an edge E_(i) to a logical truevalue upon a determination that edge E_(i) was used to update a nodevalue for a node in the plurality of nodes, (c) finding a largest valueLV for which the culprit value C_(LV) is the logical true value, and (d)removing edge E_(LV) from the ordered list.

In particular of these embodiments, method 1500 can further include: (e)initializing each node value for the plurality of nodes to the commonvalue, (f) attempting to solve the single-source path-length problem onthe graph with the edge E_(LV) removed, (g) determining whether asuccessful outcome to the single-source path-length problem occurs onthe graph with the edge E_(LV) removed, and (h) in response todetermining that the successful outcome to the single-source path-lengthproblem occurs on the graph with the edge E_(LV) removed, exiting thevariant of the Bellman-Ford algorithm.

In other of these embodiments, method 1500 can further include: inresponse to removing edge E_(LV) from the ordered list, generating asignal to a user interface. In other particular embodiments, the signalto the user interface can be configured to add one or more scroll barsto the user interface. In still other particular embodiments, the signalto the user interface can be configured to change a window size of theuser interface.

CONCLUSION

The above detailed description describes various features and functionsof the disclosed systems, devices, and methods with reference to theaccompanying figures. In the figures, similar symbols typically identifysimilar components, unless context dictates otherwise. The illustrativeembodiments described in the detailed description, figures, and claimsare not meant to be limiting. Other embodiments can be utilized, andother changes can be made, without departing from the spirit or scope ofthe subject matter presented herein. It will be readily understood thatthe aspects of the present disclosure, as generally described herein,and illustrated in the figures, can be arranged, substituted, combined,separated, and designed in a wide variety of different configurations,all of which are explicitly contemplated herein.

With respect to any or all of the ladder diagrams, scenarios, and flowcharts in the figures and as discussed herein, each block and/orcommunication may represent a processing of information and/or atransmission of information in accordance with example embodiments.Alternative embodiments are included within the scope of these exampleembodiments. In these alternative embodiments, for example, functionsdescribed as blocks, transmissions, communications, requests, responses,and/or messages may be executed out of order from that shown ordiscussed, including substantially concurrent or in reverse order,depending on the functionality involved. Further, more or fewer blocksand/or functions may be used with any of the ladder diagrams, scenarios,and flow charts discussed herein, and these ladder diagrams, scenarios,and flow charts may be combined with one another, in part or in whole.

A block that represents a processing of information may correspond tocircuitry that can be configured to perform the specific logicalfunctions of a herein-described method or technique. Alternatively oradditionally, a block that represents a processing of information maycorrespond to a module, a segment, or a portion of program code(including related data). The program code may include one or moreinstructions executable by a processor for implementing specific logicalfunctions or actions in the method or technique. The program code and/orrelated data may be stored on any type of computer readable medium suchas a storage device including a disk or hard drive or other storagemedium.

The computer readable medium may also include non-transitory computerreadable media such as computer-readable media that stores data forshort periods of time like register memory, processor cache, and randomaccess memory (RAM). The computer readable media may also includenon-transitory computer readable media that stores program code and/ordata for longer periods of time, such as secondary or persistent longterm storage, like read only memory (ROM), optical or magnetic disks,compact-disc read only memory (CD-ROM), for example. The computerreadable media may also be any other volatile or non-volatile storagesystems. A computer readable medium may be considered a computerreadable storage medium, for example, or a tangible storage device.

Moreover, a block that represents one or more information transmissionsmay correspond to information transmissions between software and/orhardware modules in the same physical device. However, other informationtransmissions may be between software modules and/or hardware modules indifferent physical devices.

While various aspects and embodiments have been disclosed herein, otheraspects and embodiments will be apparent to those skilled in the art.The various aspects and embodiments disclosed herein are for purposes ofillustration and are not intended to be limiting, with the true scopeand spirit being indicated by the following claims.

A portion of the disclosure of this patent document contains materialwhich is subject to copyright protection. The copyright owner has noobjection to the facsimile reproduction by anyone of the patent documentor patent disclosure, as it appears in the Patent and Trademark Officefile or records, but otherwise reserves all copyright rights whatsoever.

What is claimed is:
 1. A method, comprising: receiving, at a computingdevice, a layout configured to specify at least a set of rectangularcomponents within a container rectangle, wherein each rectangularcomponent has at least one size in at least one dimension; the computingdevice determining a plurality of grid lines from the layout, whereineach rectangular component of the set of rectangular components isassociated with at least two grid lines of the plurality of grid lines,the at least two grid lines based on the at least one size of therectangular component; the computing device generating a system ofconstraints, wherein each constraint of the system of constraints isrelated to at least two grid lines of the plurality of grid lines; thecomputing device generating a graph comprising a plurality of nodes anda plurality of edges, wherein each node is associated with a node value,wherein the plurality of nodes corresponds to the plurality of gridlines, and wherein the plurality of edges corresponds to the system ofconstraints; the computing device topologically sorting the plurality ofedges; the computing device determining locations for the grid lines bysolving a single-source path-length problem for the graph using avariant of the Bellman-Ford algorithm configured to operate with thetopologically-sorted plurality of edges; and the computing devicegenerating a display of at least some of the set of rectangularcomponents based on the locations of the grid lines.
 2. The method ofclaim 1, further comprising: the computing device displaying the displayof the least some of the set of rectangular components.
 3. The method ofclaim 1, wherein the graph is a directed graph, wherein at least a firstand a second edge of the plurality of edges are respectively associatedwith a first constraint and a second constraint of the system ofconstraints, wherein both the first and second constraints areassociated with a single rectangular component of the set of rectangularcomponents, wherein the first constraint comprises a constraint on aminimum value for the single rectangular component, wherein the secondconstraint comprises a constraint on a maximum value for the singlerectangular component, and wherein a direction of the first edge differsfrom a direction of the second edge.
 4. The method of claim 1, whereintopologically sorting the plurality of edges comprises: separating theplurality of edges into at least a first portion of edges and a secondportion of edges, wherein the first edge is in the first portion,wherein the second edge is in the second portion, wherein a direction ofeach edge in the first portion is the direction of the first edge, andwherein a direction of each edge in the second portion is the directionof the second edge; topologically sorting the first portion of edges;and topologically sorting the second portion of the plurality of edgesseparately from the first portion of edges.
 5. The method of claim 4,wherein solving the single-source path-length problem for the graphusing the variant of the Bellman-Ford algorithm configured to operatewith the topologically-sorted plurality of edges comprises solving thesingle-source path-length problem using a variant of the Bellman-Fordalgorithm operating upon the topologically-sorted first portion of edgesand the topologically-sorted second portion of edges.
 6. The method ofclaim 5, wherein solving the single-source path-length problem using thevariant of the Bellman-Ford algorithm operating upon thetopologically-sorted first portion of edges and the topologically-sortedsecond portion of edges comprises: generating an ordering of theplurality of edges, wherein each edge in the topologically-sorted firstportion of edges precedes each edge in the topologically-sorted secondportion of edges; generating an ordered plurality of edges, comprisingat least the topologically-sorted first portion of edges and thetopologically-sorted second portion of edges, based on the ordering ofthe plurality of edges; and solving the single-source path-lengthproblem using a variant of the Bellman-Ford algorithm operating upon theordered plurality of edges.
 7. The method of claim 1, wherein thevariant of the Bellman-Ford algorithm configured to operate with thetopologically-sorted plurality of edges comprises an inner loop and anouter loop, wherein the outer loop is configured to traverse theplurality of nodes, and wherein the inner loop is configured to traversea plurality of edges associated with a node of the plurality of nodesand determine whether at least one node weight has changed duringtraversal of the plurality of edges associated with the node.
 8. Themethod of claim 7, wherein the outer loop is configured to terminateupon determining that at least one node weight has not changed duringtraversal of the plurality of edges associated with the node.
 9. Themethod of claim 1, wherein a particular rectangular component of the setof rectangular components has at least a particular-component height anda particular-component width.
 10. The method of claim 9, wherein theplurality of grid lines comprise a plurality of horizontal grid linesand a plurality of vertical grid lines, wherein the particularrectangular component is associated with at least two horizontal gridlines of the plurality of horizontal grid lines that are related to theparticular-component height, wherein the particular rectangularcomponent is associated with at least two vertical grid lines of theplurality of vertical grid lines that are related to theparticular-component width, and wherein the system of constraintscomprises a system of horizontal constraints corresponding to theplurality of horizontal grid lines and a system of vertical constraintscorresponding to the plurality of vertical grid lines.
 11. The method ofclaim 10, wherein generating the graph comprises: generating a firstgraph associated with the plurality of horizontal grid lines and thesystem of horizontal constraints; and generating a second graphassociated with the plurality of vertical grid lines and the system ofvertical constraints, wherein solving the single-source path-lengthproblem for the graph comprises: solving a first single-sourcepath-length problem for the first graph to determine locations for theplurality of horizontal grid lines; and solving a second single-sourcepath-length problem for the second graph to determine locations for theplurality of vertical grid lines, and wherein generating the displaycomprises generating a display of at least some of the set ofrectangular components based on the locations for the plurality ofhorizontal grid lines and the locations for the plurality of verticalgrid lines.
 12. The method of claim 9, wherein the particularrectangular component additionally has at least a particular-componentdepth.
 13. A computing device, comprising: a processor; and datastorage, configured to store at least computer-readable programinstructions, wherein the instructions are configured to, upon executionby the processor, cause the computing device to perform functionscomprising: receiving a layout configured to specify at least a set ofrectangular components within a container rectangle, wherein eachrectangular component has at least one size in at least one dimension,determining a plurality of grid lines from the layout, wherein eachrectangular component of the set of rectangular components is associatedwith at least two grid lines of the plurality of grid lines, the atleast two grid lines based on the at least one size of the rectangularcomponent, generating a system of constraints, wherein each constraintof the system of constraints is related to at least two grid lines ofthe plurality of grid lines, generating a graph comprising a pluralityof nodes and a plurality of edges, wherein each node is associated witha node value, wherein the plurality of nodes corresponds to theplurality of grid lines, and wherein the plurality of edges correspondsto the system of constraints, topologically sorting the plurality ofedges, determining locations for the grid lines by solving asingle-source path-length problem for the graph using a variant of theBellman-Ford algorithm configured to operate with thetopologically-sorted plurality of edges, and generating a display of atleast some of the set of rectangular components based on the locationsof the grid lines.
 14. The computing device of claim 13, wherein thefunctions further comprise: displaying the display of the least some ofthe set of rectangular components.
 15. The computing device of claim 13,wherein the variant of the Bellman-Ford algorithm configured to operatewith the topologically-sorted plurality of edges comprises an inner loopand an outer loop, wherein the outer loop is configured to traverse theplurality of nodes, and wherein the inner loop is configured to traversea plurality of edges associated with a node of the plurality of nodesand determine whether at least one node weight has changed duringtraversal of the plurality of edges associated with the node.
 16. Thecomputing device of claim 15, wherein the outer loop is configured toterminate upon determining that at least one node weight has not changedduring traversal of the plurality of edges associated with the node. 17.The computing device of claim 13, wherein a particular rectangularcomponent of the set of rectangular components has at least aparticular-component height and a particular-component width.
 18. Thecomputing device of claim 17, wherein the plurality of grid linescomprise a plurality of horizontal grid lines and a plurality ofvertical grid lines, wherein the particular rectangular component isassociated with at least two horizontal grid lines of the plurality ofhorizontal grid lines that are related to the particular-componentheight, wherein the particular rectangular component is associated withat least two vertical grid lines of the plurality of vertical grid linesthat are related to the particular-component width, and wherein thesystem of constraints comprises a system of horizontal constraintscorresponding to the plurality of horizontal grid lines and a system ofvertical constraints corresponding to the plurality of vertical gridlines.
 19. The computing device of claim 18, wherein generating thegraph comprises: generating a first graph associated with the pluralityof horizontal grid lines and the system of horizontal constraints; andgenerating a second graph associated with the plurality of vertical gridlines and the system of vertical constraints, wherein solving thesingle-source path-length problem for the graph comprises: solving afirst single-source path-length problem for the first graph to determinelocations for the plurality of horizontal grid lines; and solving asecond single-source path-length problem for the second graph todetermine locations for the plurality of vertical grid lines, andwherein generating the display comprises generating a display of atleast some of the set of rectangular components based on the locationsfor the plurality of horizontal grid lines and the locations for theplurality of vertical grid lines.
 20. The method of claim 17, whereinthe particular rectangular component further comprises aparticular-component depth.
 21. A device including a non-transitorycomputer-readable storage medium having instructions stored thereonthat, in response to execution by a computing device, cause thecomputing device to perform functions comprising: receiving a layoutconfigured to specify at least a set of rectangular components within acontainer rectangle, wherein each rectangular component has at least onesize in at least one dimension; determining a plurality of grid linesfrom the layout, wherein each rectangular component of the set ofrectangular components is associated with at least two grid lines of theplurality of grid lines, the at least two grid lines based on the atleast one size of the rectangular component; generating a system ofconstraints, wherein each constraint of the system of constraints isrelated to at least two grid lines of the plurality of grid lines;generating a graph comprising a plurality of nodes and a plurality ofedges, wherein each node is associated with a node value, wherein theplurality of nodes corresponds to the plurality of grid lines, andwherein the plurality of edges corresponds to the system of constraints;topologically sorting the plurality of edges; determining locations forthe grid lines by solving a single-source path-length problem for thegraph using a variant of the Bellman-Ford algorithm configured tooperate with the topologically-sorted plurality of edges; and generatinga display of at least some of the set of rectangular components based onthe locations of the grid lines.
 22. The device of claim 21, wherein thefunctions further comprise: displaying the least some of the set ofrectangular components.
 23. The device of claim 21, wherein the graph isa directed graph, wherein at least a first and a second edge of theplurality of edges are respectively associated with a first constraintand a second constraint of the system of constraints, wherein both thefirst and second constraints are associated with a single rectangularcomponent of the set of rectangular components, wherein the firstconstraint comprises a constraint on a minimum value for the singlerectangular component, wherein the second constraint comprises aconstraint on a maximum value for the single rectangular component, andwherein the first edge has a first direction and the second edge has asecond direction that differs from the first direction.
 24. The deviceof claim 23, wherein topologically sorting the plurality of edgescomprises: separating the plurality of edges into at least a first setof edges and a second set of edges such that the first edge is in thefirst set of edges and the second edge is in the second set of edges,wherein each edge in the first set of edges has the first direction, andwherein each edge in the second set of edges has the second direction;topologically sorting the first set of edges; and topologically sortingthe second set of edges separately from the first set of edges.
 25. Thedevice of claim 24, wherein solving the single-source path-lengthproblem for the graph using the variant of the Bellman-Ford algorithmconfigured to operate with the topologically-sorted plurality of edgescomprises solving the single-source path-length problem using a variantof the Bellman-Ford algorithm operating upon the topologically-sortedfirst portion of edges and the topologically-sorted second portion ofedges.
 26. The device of claim 25, wherein the solving the single-sourcepath-length problem using the variant of the Bellman-Ford algorithmoperating upon the topologically-sorted first set of edges and thetopologically-sorted second set of edges comprises: generating anordering of the plurality of edges, wherein each edge in thetopologically-sorted first set of edges precedes each edge in thetopologically-sorted second set of edges; generating an orderedplurality of edges that comprises at least the topologically-sortedfirst set of edges and the topologically-sorted second set of edges,based on the ordering of the plurality of edges; and solving thesingle-source path-length problem using the variant of the Bellman-Fordalgorithm operating upon the ordered plurality of edges.
 27. The deviceof claim 21, wherein the variant of the Bellman-Ford algorithmconfigured to operate with the topologically-sorted plurality of edgescomprises an inner loop and an outer loop, wherein the outer loop isconfigured to traverse the plurality of nodes, and wherein the innerloop is configured to traverse a plurality of edges associated with anode of the plurality of nodes and determine whether at least one nodeweight has changed during traversal of the plurality of edges associatedwith the node.
 28. The device of claim 27, wherein the outer loop isconfigured to terminate upon determining that at least one node weighthas not changed during traversal of the plurality of edges associatedwith the node.
 29. The device of claim 21, wherein a particularrectangular component of the set of rectangular components has at leasta particular-component height and a particular-component width.
 30. Thedevice of claim 29, wherein the plurality of grid lines comprise aplurality of horizontal grid lines and a plurality of vertical gridlines, wherein the particular rectangular component is associated withat least two horizontal grid lines of the plurality of horizontal gridlines that are related to the particular-component height, wherein theparticular rectangular component is associated with at least twovertical grid lines of the plurality of vertical grid lines that arerelated to the particular-component width, and wherein the system ofconstraints comprises a system of horizontal constraints correspondingto the plurality of horizontal grid lines and a system of verticalconstraints corresponding to the plurality of vertical grid lines.